A Command Reference

Note:

Java Flight Recorder requires a commercial license for use in production. To learn more about commercial features and how to enable them please visit http://www.oracle.com/technetwork/java/javaseproducts/.

This appendix serves as a basic reference to the commands you can use with Java Flight Recorder. It contains the following sections:

A.1 Command-Line Options

When you launch your Java application with the java command, you can specify options to enable Java Flight Recorder, configure its settings, and start a recording. The following command-line options are specific to Java Flight Recorder:

  • -XX:+|-FlightRecorder

  • -XX:FlightRecorderOptions

  • -XX:StartFlightRecording

These command-line options are available only in the commercial license of the JDK. To use them, you have to also specify the -XX:+UnlockCommercialFeatures option, or unlock commercial features after the application is running. For examples of unlocking commercial features and starting a flight recording dynamically at runtime, see Section 2.1, "Using the Command Line".

Note:

You should use -XX options only if you have a thorough understanding of your system. If you use these commands improperly, you might affect the stability or performance of your system. -XX options are experimental, and they are subject to change at any time.

A.2 Diagnostic Command Reference

This is a description of the diagnostic commands available to control Java Flight Recorder and the parameters available for each command. This information is also available by running the jcmd command with the process identifier specified, followed by the help parameter and the command name. For example, to get help information for the JFR.start command on a running JVM process with the identifier 5361, run the following:

jcmd 5361 help JFR.start

To get a full list of diagnostic commands available to the JVM, do not specify the name of the command.

The diagnostic commands associated with Java Flight Recorder are:

A.2.1 JFR.start

The JFR.start diagnostic command starts a flight recording. Table A-1 lists the parameters you can use with this command.

Table A-1 JFR.start

Parameter Description Type of value Default

name

Name of recording

String

 

settings

Server-side template

String

 

defaultrecording

Starts default recording

Boolean

False

delay

Delay start of recording

Time

0s

duration

Duration of recording

Time

0s (means "forever")

filename

Resulting recording filename

String

 

compress

GZip compress the resulting recording file

Boolean

False

maxage

Maximum age of buffer data

Time

0s (means "no age limit")

maxsize

Maximum size of buffers in bytes

Long

0 (means "no max size")


A.2.2 JFR.check

The JFR.check command shows information about running recordings. Table A-2 lists the parameters you can use with this command.

Table A-2 JFR.check

Parameter Description Type of value Default

name

Recording name

String

 

recording

Recording id

Long

1

verbose

Print verbose data

Boolean

False


A.2.3 JFR.stop

The JFR.stop diagnostic command stops running flight recordings. Table A-3 lists the parameters you can use with this command.

Table A-3 JFR.stop

Parameter Description Type of value Default

name

Recording name

String

 

recording

Recording id

Long

1

discard

Discards the recording data

Boolean

 

copy_to_file

Copy recording data to file

String

 

compress_copy

GZip compress "copy_to_file" destination

Boolean

False


A.2.4 JFR.dump

The JFR.dump diagnostic command stops running flight recordings. Table A-4 lists the parameters you can use with this command.

Table A-4 JFR.dump

Parameter Description Type of value Default

name

Recording name

String

 

recording

Recording id

Long

1

copy_to_file

Copy recording data to file

String

 

compress_copy

GZip compress "copy_to_file" destination

Boolean

False


A.2.5 VM.unlock_commercial_features

The VM.unlock_commercial_features command is used to unlock commercial features in a JVM that is already running. This command has no parameters.

A.2.6 VM.check_commercial_features

The VM.check_commercial_features command is used to check whether commercial features are locked or unlocked in a JVM that is already running. This command has no parameters.