Aggregate frames by line-in-function (java)
- Dominant language
- Python
- Stars
- 826
- Forks
- 79
- PR merge metrics
- No merged PRs in 30d
Description
gProfiler collects profiles function-based, i.e, each frame represents a function.
An alternative is to aggregate line-in-function, so each frame is `function:line`. This creates a graph that is more fragmented, but carries more information (for example: function A calling function B twice will now have 2 separate callstacks for B under A, allowing you to differentiate).
Various profilers already support it (for example, py-spy does, as far as I'm aware). I want to start with support in Java (so async-profiler).
The feature requirements are:
1. A flag in gProfiler enabling the behavior: `--line-numbers` suffices.
2. This flag is passed into `ProfilerState` and used by Profiler classes supporting it.
3. In the case of `JavaProfiler`, async-profiler alreadys supports line numbering, see code that extracts the BCI -> line numbers table [here](https://github.com/async-profiler/async-profiler/blob/cb1c00013f4666941c1214234fcbff7675f34497/src/flightRecorder.cpp#LL228C4-L228C4). It exists for JFR. As we're using the collapsed format, we can add this support to collapsed, [like we added method modifers](https://github.com/Granulate/async-profiler/pull/5/files#diff-e57ee6f63202233cb81b2d09abfb9a6d18b1af092d923694bdb62fd4030bc18a).
4. Syntax of the frame can be: add `:line_number` between the `_[...]` suffix to the frame name itself.
Note that line-of-function was added here: https://github.com/Granulate/gprofiler/pull/821. This ticket is for line-in-function.
Contributor guide
Assessment
This issue has not been assessed yet.