KEMBAR78
Allow users to control the clock implementation · Issue #723 · async-profiler/async-profiler · GitHub
Skip to content

Allow users to control the clock implementation #723

@danielmitterdorfer

Description

@danielmitterdorfer

We run async profiler and perf sched record to gather CPU and scheduler stack traces respectively. For async profiler we use -o jfr. We then postprocess and merge both output files into a combined view which allows us to see what code was on CPU and the reason why it went off CPU (and at which point).

A key issue is alignment of timestamps. While we can configure a specific clock source with perf sched record (e.g. perf sched record -k CLOCK_MONOTONIC), the clock source in async profiler is not configurable and dependent on the CPU architecture, which defaults to rdtsc on Intel CPUs and OS::nanotime (which is CLOCK_MONOTONIC in Linux) for all others.

In order to align timestamps of multiple data sources we would like to have control over the clock source in async profiler similar to perf sched record via a command line switch. Just being able to force usage of OS::nanotime would be sufficient, there is no need to implement new clock sources. I did a proof of concept by simply setting TSC_SUPPORTED to false which allowed us to align the timestamps.

I'm happy to work on a PR but I first wanted to gauge whether there is interest for this feature.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions