perf: display process name as first frame, not thread name
- 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:

`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
Assessment
This issue has not been assessed yet.