I use an event loop architecture in my Java application. Some cycles of the event loop are several orders of magnitude slower than the median ones. I use async profiler to profile my application. It shows where my application spends time on average, which is not instructive for profiling outliers. Ideally, I would like to have the following workflow.
- In the beginning of the loop cycle I tell the profiler to start collecting stack traces.
- The profiler starts to store them in a local buffer, but doesn’t yet apply them to the profile.
- In the end of the loop I look at the clock. If the cycle time is larger than a threshold T, then I tell the profiler to apply the collected data. If the elapsed time is lower than T, then I tell the profiler to discard this data.
This way I will be able to gain visibility in the slow rare events.
Is there way to implement such workflow in async profiler? Or maybe some other profiler supports this?