How to record allocations with JFR on command line?
Asked Answered
S

2

6

I have a profile I've created with Java Mission Control that has allocation profiling enabled. When I used it from the JMC UI to record, everything works fine and I get the results.

However, after exporting the settings and trying to record with JFR on command line, I don't get the allocations recorded, even though I get other profiling information.

I run the recording with the following settings: JAVA_OPTS="$JAVA_OPTS -XX:+UnlockCommercialFeatures -XX:+FlightRecorder -XX:FlightRecorderOptions=defaultrecording=true,settings='<path_to_settings>/settings.jfc',dumponexit=true,dumponexitpath=<output>" java -jar stuff

When loading the recording in JMC and checking the memory part, I see message Event type 'Allocation in new TLAB' is not enabled in this recording.

The settings file is here: https://gist.github.com/jmiettinen/1976f9bbe156ecb5e232 and it has the relevant settings java/object_alloc_in_new_TLAB and java/object_alloc_outside_TLABenabled.

Am I missing something here? I am running 1.8.0_66 and would want to have a continuous recording from the start of the application until it is stopped.

Spiry answered 19/1, 2016 at 16:31 Comment(1)
These options seem to work for me if you want to have a continuous recording with the special settings and get it to dump the data on exit: -XX:FlightRecorderOptions=dumponexit=true,dumponexitpath=rec.jfr -XX:StartFlightRecording=defaultrecording=true,settings=d:/tmp/wop.jfcSiret
S
7

Verified with @jmiettin at Jfokus that these flags do the trick:

These options seem to work for me if you want to have a continuous recording with the special settings and get it to dump the data on exit: -XX:FlightRecorderOptions=dumponexit=true,dumponexitpath=rec.jfr -XX:StartFlightRecording=defaultrecording=true,settings=d:/tmp/wop.jfc

Difference is to put defaultrecording and settings parameters after the -XX:StartFlightRecording flag instead.

Siret answered 10/2, 2016 at 8:48 Comment(0)
C
1

Which version of the JDK are you running?

There is a bug, fixed in 7u76 and 8u20, where the settings parameter is not respected if defaultrecording=true.

Covalence answered 22/1, 2016 at 6:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.