Profiling multiple perf events within one command
Describe the feature
currently you can profile perf events using asprof -e cycles -d -f <output_file> <PID_or_App_Name> I would like to be able to say profile asprof -e cycles,instructions and then have secondary outputs stored as another field in the jfr file output.
Use Case
We are using them to create these https://www.brendangregg.com/blog/2014-10-31/cpi-flame-graphs.html for java programs. They require taking both cycles and instructions.
Proposed Solution
I currently implemented by adding something like _events[tid]._counter_fd to perfEvents.cpp then passing it through to the JFR files. This seems to look accurate from my tests but my impl. The passing it through to the JFR file part looks a bit messy (Adding fields to ExecutionEvent) but I'm guessing theirs a better way to do this?. Implementing this for any amount on perf events seems a bit larger of a change so im fine just having it support profiling two perf events. This feature would only support outputting it for jfr files as a custom entry.
Acknowledgements
- I may be able to implement this feature request
- This feature might incur a breaking change
Source: async-profiler/async-profiler