-XX:StartFlightRecording
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
jcmdoptions 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
jcmdoptions.
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.jfrextension. If a file name is not specified, the recording is saved in thedefaultJ9recording.jfrfile in the process working directory by default. -
duration=<time_with_unit_of_time>specifies the duration of the recording. Units of time arens(nanoseconds),us(microseconds),ms(milliseconds),s(seconds),m(minutes),h(hours), andd(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 arens(nanoseconds),us(microseconds),ms(milliseconds),s(seconds),m(minutes),h(hours), andd(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 of0sis 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.
