We use the gradle-profiler for automatically profiling Gradle builds. It can run many iterations of the same build in order to collect enough data. For many scenarios you want some kind of cleanup step between iterations and you don't want to profile that cleanup. So it would be great if I could tell async-profiler to pause its recording and later resume, keeping the data collected so far intact. That way I don't have to merge profiled data from multiple files later.
This should be fairly easy to do. I'll consider implementing this feature.
I've committed the pause/resume feature.
Instead of the pause action, which does not differ from stop, I added new resume action, which works just like start except it does not reset collected data.
Profiling options are not preserved between sessions, i.e. all the previous options should be repeated in the resume command. This is intentional, because 1) it makes easier to run resume/stop sequence without additional checks, whether the profiler starts for the first time or not; 2) it avoids questionable reuse of arguments that could be specified in -agentpath options, attach command, or via Java API.
Additionally, a few improvements were made to improve resume latency, e.g. the profiler now does not parse symbols from the libraries that were parsed earlier.
From user's perspective the changes include
resume action in profiler.sh script;resume option for -javaagent;AsyncProfiler.resume(event, interval) method in Java API.
Most helpful comment
This should be fairly easy to do. I'll consider implementing this feature.