Class Recording
java.lang.Object
one.profiler.Recording
Tracks async-profiler's recording state and provides timestamps aligned with the profiler clock.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intA JFR session is running.static final intasync-profiler is loaded, but no JFR session is running.static final intasync-profiler is not loaded. -
Method Summary
Modifier and TypeMethodDescriptionstatic longReturns the tick rate of thetimestamp()clock.static intstate()static long
-
Field Details
-
UNAVAILABLE
public static final int UNAVAILABLEasync-profiler is not loaded.- See Also:
-
STOPPED
public static final int STOPPEDasync-profiler is loaded, but no JFR session is running.- See Also:
-
RUNNING
public static final int RUNNINGA JFR session is running.- See Also:
-
-
Method Details
-
state
public static int state()- Returns:
- the current recording state:
UNAVAILABLE,STOPPEDorRUNNING
-
clockFrequency
public static long clockFrequency()Returns the tick rate of thetimestamp()clock. The frequency is not a constant: it may change when a recording starts, since async-profiler can switch the clock source between recordings.The frequency alone is enough to convert durations to profiler ticks.
- Returns:
- the number of ticks per second of the profiler clock
-
timestamp
public static long timestamp()- Returns:
- the current time in the same clock async-profiler uses for its events, so span and sample timestamps are comparable
-