Today recordings can be started using jcmd or on command line, i.e. -XX:StartFlightRecording, with a predefined configuration that is shipped with the JDK (default or profile).
If you want to do more advanced event configuration, you can either copy and edit the default.jfc file or use the Template manager in JMC. The template manager provides high-level controls, for example enable class loading or set the method profiling level to high. It would be convenient if class loading, method profiling level etc. could be set on command line as well, for example
$ java -XX:StartFlightRecording:class-loading=enable,method-profiling=high ...
Before adding such functionality to the JVM, it would be good to add the core feature as a separate command to the 'jfr' tool. It will simplify implementation/testing and provide users with a human readable description of what capabilities a particular .jfc file provide. This is needed anyway if user are to specify them on command line.
Example:
$ jfr configure class-loading=enable method-profiling=high
New configuration written to custom.jfc.
Use java -XX:StartFlightRecording:settings=custom.jfc ... to use
$ jfr configure --jfc c:/tmp/acme.jfc gc=detailed --output new.jfc
New configuration written to new.jfc
Use java -XX:StartFlightRecording:settings=new.jfc ... to use
If you don't specify setting parameters, the tool launch into interactive mode where users can specify settings:
$ jfr configure --output my.jfc
Garbage Collector [Off/Normal/All]: Off
Class Loading [Yes/No]: Yes
Synchronization threshold: 20 ms
...
New configuration written to my.jfc
Use java -XX:StartFlightRecording:settings=my.jfc ... to use
The tool will also help user to prepare setting files from multiple .jfc files. By default the tool will include setting for the JVM (default.jfc). If user want to opt-out, the option --no-default will be available, for example:
$ jfr configure --no-default --jfc spring.jfc,coherence.jfc --output configuration.jfc
To get a description of what options a -jfc file provide the help option can be used:
$ jfr help configure spring.jfc
High-level controls have been available in the .jfc file from the inception of the file format.
If you want to do more advanced event configuration, you can either copy and edit the default.jfc file or use the Template manager in JMC. The template manager provides high-level controls, for example enable class loading or set the method profiling level to high. It would be convenient if class loading, method profiling level etc. could be set on command line as well, for example
$ java -XX:StartFlightRecording:class-loading=enable,method-profiling=high ...
Before adding such functionality to the JVM, it would be good to add the core feature as a separate command to the 'jfr' tool. It will simplify implementation/testing and provide users with a human readable description of what capabilities a particular .jfc file provide. This is needed anyway if user are to specify them on command line.
Example:
$ jfr configure class-loading=enable method-profiling=high
New configuration written to custom.jfc.
Use java -XX:StartFlightRecording:settings=custom.jfc ... to use
$ jfr configure --jfc c:/tmp/acme.jfc gc=detailed --output new.jfc
New configuration written to new.jfc
Use java -XX:StartFlightRecording:settings=new.jfc ... to use
If you don't specify setting parameters, the tool launch into interactive mode where users can specify settings:
$ jfr configure --output my.jfc
Garbage Collector [Off/Normal/All]: Off
Class Loading [Yes/No]: Yes
Synchronization threshold: 20 ms
...
New configuration written to my.jfc
Use java -XX:StartFlightRecording:settings=my.jfc ... to use
The tool will also help user to prepare setting files from multiple .jfc files. By default the tool will include setting for the JVM (default.jfc). If user want to opt-out, the option --no-default will be available, for example:
$ jfr configure --no-default --jfc spring.jfc,coherence.jfc --output configuration.jfc
To get a description of what options a -jfc file provide the help option can be used:
$ jfr help configure spring.jfc
High-level controls have been available in the .jfc file from the inception of the file format.
- duplicates
-
JDK-8260862 JFR: New configure command for the jfr tool
- Resolved