intel / intel/gprofiler

perf: display process name as first frame, not thread name

Open
#431 2 comments 0 reactions 0 assignees View on GitHub
runtime/perf
Dominant language
Python
Stars
826
Forks
79
PR merge metrics
No merged PRs in 30d

Description

`perf` emits the thread comm as the comm of samples, and that's taken to be the first frame of a sample.

This results in profiles like this one:

![image](https://user-images.githubusercontent.com/8831572/183268784-a718ad81-3520-4b9e-9ac7-3b3031948603.png)

`Attach API wait` is the thread's comm. The process comm is `java`. This sample shows async-profiler in the stack but I'm fairly certain it was taken by `perf` :sweat_smile: in any case I have definitely seen this happen with `perf`.

I still don't understand if this happens on all Linux kernel versions or only on a subset, so the first thing would be to reproduce this - create a binary that starts a thread, renames it runs a busy loop; then profile that app with gProfiler. Test it on multiple Linux versions - 5.x, 4.x, 3.x.
Then I suggest checking different `perf script` flags - it might be doable via flags only.

Note that we already make some changes to the printed comm - we build a slightly patched `perf` from [this tag](https://github.com/Granulate/linux/tree/v5.18g1), and we have in particular [a change that revolves around comms](https://github.com/Granulate/linux/commit/40a7823cf90a7e69ce8af88d224dfdd7e371de2d).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.