javaperformanceperformance-testingjfrjava-mission-control

How to end and save Java Flight Recorder recording in Java Mission Control when application ends?


I am currently using Java Mission Control (JMC) to profile my application's performance with the Java Flight Recorder (JFR) plugin.

I know how to set up JFR on the command line to record from the beginning to the end of the application duration. However, I do not know how to do it when using the JFR plugin in JMC. Is this something that is possible in JMC? Or am I only able to do this on the command line?

And to better describe the current dilemma, when my application ends, JMC pops up a warning dialog saying that the JVM ended unexpectedly, and then from there, I lose my recording.

A screenshot of the warning dialog that says "Problem while monitoring recording My Recording on [21] ConnectFour.Main (27280). The monitored JVM might have been terminated." -- further down on the dialog is a checked checkbox that says "Show warnings for problems that occur while monitoring flight recordings."

I'm sure the answer to this is relatively simple, but I don't see any easily accessible resources that provide the answer.

EDIT - I am aware of how to start a recording on JMC using JFR, that's not my question here. My question is how do I get the command line benefits (record the whole application's life time, and then save the recording upon application close) on JMC?


Solution

  • Right-click in the JVM Browser and select "Start Flight Recording ...", specify the amount of time you want the recording to be, for example 10 minutes. When the recording is finished, recording data is transferred and displayed in JMC.

    If the application exits before the specified time, the recording will be lost. You will have to make sure the application doesn't exit, or specify a shorter recording time, or start the recording from command line and open the file.