Skip to content

CAUTION: This site hosts draft documentation for the next release. For published content of the latest release, visit eclipse.dev/openj9/docs

-XX:StartFlightRecording

Start of content that applies to Java 11 (LTS) and later This command-line option starts the JDK Flight Recorder (JFR) recording in the VM. JFR is a built-in profiling and troubleshooting feature in the VM that is used to collect profiling and diagnostic information.

Notes:

  • JFR recording can also be enabled or disabled on OpenJ9 by using the jcmd options as explained in the -XX:[+|-]FlightRecorder topic. The JDK Mission Control (JMC) tool is the only way to view the produced JFR file.
  • The command-line option cannot be used simultaneously with JFR-related jcmd options.

Syntax

    -XX:StartFlightRecording[[=filename=<file_name_with_path>.jfr][,duration=<time_with_unit_of_time>][,delay=<time_with_unit_of_time>]

where:

  • Optional parameters are shown in brackets, [ ].

  • filename=<file_name_with_path> specifies the name of the file and its location where the recording is saved. The file name should have a .jfr extension. If a file name is not specified, the recording is saved in the defaultJ9recording.jfr file in the process working directory by default.

  • duration=<time_with_unit_of_time> specifies the duration of the recording. Units of time are ns (nanoseconds), us (microseconds), ms (milliseconds), s (seconds), m (minutes), h (hours), and d (days). You can specify only one unit of time, for example, 54s, 12m, 1h, or 2d. If the duration is not specified, the tool continues to record until the VM is shut down.

  • delay=<time_with_unit_of_time> specifies the delay in the start of the recording. The VM waits for that amount of time before starting the flight recording. Units of time are ns (nanoseconds), us (microseconds), ms (milliseconds), s (seconds), m (minutes), h (hours), and d (days). You can specify only one unit of time, for example, 54s, 12m, 1h, or 2d. If the delay is not specified, the default value of 0s is used. The recording then starts immediately when the VM starts.

Explanation

If JFR is enabled in the VM with the -XX:+FlightRecorder option, then you can trigger profile and diagnostic recording with either the -XX:StartFlightRecording command-line option or the jcmd tool. Recording does not start automatically, it must be triggered.

Example of the command-line option:

-XX:StartFlightRecording=filename=/path/ABCD.jfr,duration=4s,delay=2s

The recording stops automatically with the duration parameter or when the VM stops.

End of content that applies to Java 11 (LTS) and later

See Also