Java 11 was released on September 26, 2018. From this version, Flight Recorder can be used with OpenJDK, so let's see how to use it.
Mission control is required to view the files recorded by Flight Recorder and must be installed separately from the JDK. You can find the installer at the following site. https://jdk.java.net/jmc/ (Early access as of October 18, 2018)
mission control sample screen
Profiling recording is a usage such as recording from XX seconds to YY seconds. Specify the following options when executing the java command.
-XX:StartFlightRecording=delay=20s,duration=60s,filename=myRecording.jfr,settings=profile,name=SampleRecording
--delay specifies how many seconds after executing the java command to start recording -duration is the number of seconds to record --Specify the file to save the record with filename (you can see the profile by reading this file with mission control)
You can record continuously and save the latest X-minute profile or full-term profile to a file as needed. Specify the following options when executing the java command.
-XX:+FlightRecorder -XX:StartFlightRecording=maxage=5m,settings=default,disk=true
--maxage is the maximum retention period
You may want to apply the flight recorder to an application that is already running.
In that case, you can start recording by selecting Start Flight Recording
from the mission control screen.
Both profiling recording
and continuous recording
can be selected.
mission control When you load the jfr file saved on the disk, the following profile screen will be displayed.
On the Threads screen, you can see the same information as the information that can be obtained by thread dump.
On the memory screen, you can see the same information as the information that can be obtained by heap dump.
In method profiling, you can see which method is called most often. It's useful for performance analysis.
Garbage collection shows the same information as GC logs.