Is there a way to check if a particular jdk (Oracle or OpenJDK) supports Java Flight Recorder? I have been trying to run my app on OPEN JDK 8 as following
java -XX:StartFlightRecording
But this does not work on OPEN JDK 8
. I get following error Unrecognized VM option -XX:+UnlockCommercialFeatures
but does not work
You need to 'unlock the commercial features' as described here:
https://docs.oracle.com/javacomponents/jmc-5-4/jfr-runtime-guide/run.htm#JFRUH176
The command should look like this:
java -XX:+UnlockCommercialFeatures -XX:+FlightRecorder -XX:StartFlightRecording=duration=60s,filename=myrecording.jfr MyApp
One way to check if a JVM supports JFR is to do:
$ jdb
Open a second shell.
$ jcmd
Remember the pid of the jdb process and do:
$ jcmd <pid> help
If the JVM list diagnostic commands starting with JFR, it is supported. If the JDK lacks jcmd, JFR is not supported (unless it is a JRockit JVM in which case jcmd is called jrcmd and the command to look for is start_flightrecording).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.