-XX:[+|-]FlightRecorder
This option enables or disables JDK Flight Recorder (JFR) in the VM. This built-in profiling and troubleshooting feature in the VM collects profiling and diagnostic information.
Note: OpenJ9 offers limited support for JFR functionalities. JFR can be enabled on OpenJ9 only by using the jcmd options. The produced JFR file can be viewed by using the JDK Mission Control (JMC) tool.
Syntax
-XX:[+|-]FlightRecorder
| Setting | Effect | Default |
|---|---|---|
-XX:+FlightRecorder |
Enable | yes |
-XX:-FlightRecorder |
Disable |
Explanation
If JFR 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.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 ares(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 recording is manually stopped or the VM is shut down.
Example:
jcmd 1234 JFR.start filename=/path/ABCD.jfr duration=4s
All JFR-related jcmd options might change in future releases.
Limitations:
- JFR produces only the following events:
- ClassLoadingStatistics
- CPUInformation
- CPULoad (except z/OS)
- ExecutionSample
- GCHeapConfig
- InitialEnvironmentVariable
- InitialSystemProperty
- JVMInformation
- ModuleExports
- ModuleRequires
- MonitorEnter
- MonitorWait
- NativeLibrary (except z/OS)
- OSInformation
- PhysicalMemory
- SystemGC
- SystemProcess (except z/OS)
- ThreadContextSwitchRate
- ThreadCPULoad (except z/OS)
- ThreadDump
- ThreadEnd
- ThreadPark
- ThreadSleep
- ThreadStart
- ThreadStatistics
- VirtualizationInformation
- YoungGenerationConfig
Note: To record and analyze the SystemProcess JFR event on z/OS (2.5 and 3.1), you must install APAR OA62757.
-
Support for the following capabilities is not available:
-XX:StartFlightRecordingand-XX:FlightRecorderOptions- JFR APIs (
jdk/jfr/*classes) - Controlling JFR with Java Management Extensions (JMX)
- JFR streaming
Support for JFR will be expanded in future releases.
