Skip to content

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

-XX:[+|-]FlightRecorder

Linux® on x86, Linux on AArch64

Start of content that applies to Java 11 (LTS) and later This option enables or disables the Java Flight Recorder (JFR) tool in the VM. This built-in profiling and troubleshooting tool in the VM collects profiling and diagnostic information.

Note: Support for the JFR tool is currently provided as a technical preview. All JFR-related jcmd options might change in future releases.

Syntax

    -XX:[+|-]FlightRecorder
Setting Effect Default
-XX:+FlightRecorder Enable yes
-XX:-FlightRecorder Disable

Explanation

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

To start a recording, specify the following command:

jcmd <vmid | display name | 0> JFR.start [filename=<file_name_with_path>] [duration=<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 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 recording is manually stopped or the VM is shut down.

Example:

jcmd 1234 JFR.start filename=/path/ABCD.jfr duration=4s

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

See Also