How does JFR calculate Event Start Time?

206 Views Asked by At

I'm profiling an application with JFR using jcmd tool. Sometimes, when I generate the JFR file, recordings starts much before than I have started to record. For example:

JFR recording

I have searched information about this question, but I just have found this link:

https://blogs.oracle.com/poonam/clarifying-some-confusion-around-java-flight-recordings

As this blog post raises, I have search events on the JMC event log, but with I have not found any event before I have started the recording.

So my question is, how does JFR calculates "Events Start Time"?

I don't know if it's relevant, but I also include commands sent with jcmd:

jcmd 1 JFR.start name=profile settings=profile maxage=10m

Some minutes after, I will dump and stop the recording with:

jcmd 1 JFR.dump name=profile filename=/tmp/recording.jfr

jcmd 1 JFR.stop name=profile

Thank you so much, for your help!

1

There are 1 best solutions below

1
On

The event start time is when the event was started.

Events may in some circumstances start before the recording. For example,

  1. Recording A starts
  2. Event starts (start time is taken)
  3. Recording A ends
  4. Recording B starts
  5. Event ends (end time is taken)
  6. Recording B ends

Recording B will contain the event, as it is written to the file when the event ends, but the start time will happen before recording B started. Other reason this can happen is skew between the clock on different CPUs.