Class Recording

java.lang.Object
one.profiler.Recording

public class Recording extends Object
Tracks async-profiler's recording state and provides timestamps aligned with the profiler clock.
  • Field Details

    • UNAVAILABLE

      public static final int UNAVAILABLE
      async-profiler is not loaded.
      See Also:
    • STOPPED

      public static final int STOPPED
      async-profiler is loaded, but no JFR session is running.
      See Also:
    • RUNNING

      public static final int RUNNING
      A JFR session is running.
      See Also:
  • Method Details

    • state

      public static int state()
      Returns:
      the current recording state: UNAVAILABLE, STOPPED or RUNNING
    • clockFrequency

      public static long clockFrequency()
      Returns the tick rate of the timestamp() 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