KEMBAR78
Fetch which CPU core a sample was taken on · Issue #1240 · async-profiler/async-profiler · GitHub
Skip to content

Fetch which CPU core a sample was taken on #1240

@JugadK

Description

@JugadK

Describe the feature

async profiler output that contains info on which cpu a sample was taken on

Use Case

Sometimes it can be useful to see if a certain cpu core was being pinned with high utilization, and what code was running on that core. When using perf, we have found this to be helpful occasionally

Proposed Solution

Initial idea was to pull the cpu info from the PERF_SAMPLE_CPU

I hacked together a patch where I enable PERF_SAMPLE_CPU in PerfEvents::createForThread if the cstack is VMX, then pull them from the ringbuffer in PerfEvents::Walk. I then push it in java_ctx and pass it into jdk.ExecutionSample as a "cpu" field for each sample, which I then output into the jfr file.

From some basic testing this seemed to have worked, but was hoping if you had any input if this could be upstreamed and any other pitfalls this may have. Not sure if adding the "cpu" field in the jfr file might break something? I passed it into IntelliJ and the jfr cli, and it seems to have picked it up all fine.

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

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