-
Notifications
You must be signed in to change notification settings - Fork 937
Description
Background
One of async-profiler features is time-to-safepoint profiling (--ttsp option) which enables collection of CPU or wall-clock events only in the time window between a safepoint has been requested and all Java threads have been stopped. This helps to diagnose the cause of long time-to-safepoint pauses.
--ttsp option is the most useful with JFR output format, since it preserves all samples with timestamps in a way that they can be matched with the corresponding pauses. However, to trace these pauses, user needs to enable safepoint logging and then manually match JFR samples with the VM logs.
It would be helpful to emit an additional JFR event for each time-to-safepoint pause to make it possible to analyze pauses using only the profiler recording independently of the VM logs.
Proposal
Introduce new event in async-profiler recordings for time-to-safepoint pauses. In fact, this event can be generalized for any combination of --begin/--end triggers, not just for safepoints.
Implementation
Add profiler.Window JFR event with the following fields:
- startTime
- duration
- eventThread
It will be emitted for every time window between --begin and --end traps. In particular, for --ttsp feature, each profiler.Window event will correspond to the time interval between the execution of SafepointSynchronize::begin and RuntimeService::record_safepoint_synchronized functions - in other words, each event will denote a corresponding time-to-safepoint pause.