Running Java Flight Recorder with a profiler (-prof jfr)

Aggelos Biboudis biboudis at gmail.com
Wed Aug 13 12:53:37 UTC 2014


Hi all!

Recently, I used jfr to profile microbenchmarks. My intentions were two: 1)
to profile right away from the beginning and 2) per each microbenchmark.

What we could do at the moment afaik is to pass the arguments manually (to
get a single jfr file) or programmatically as arguments of the @Fork
annotation to get them separately, e.g.,:

@Fork(jvmArgsAppend =
> { "-XX:+UnlockCommercialFeatures",
>   "-XX:+FlightRecorder",
>
> "-XX:StartFlightRecording=duration=60s,filename=./profiling-data.jfr,name=FULL,settings=profile",
>
> "-XX:FlightRecorderOptions=settings=./openjdk/jdk1.8.0/jre/lib/jfr/FULL.jfc,samplethreads=true"
> })


As a proof of concept, I created a profiler (jfr) that does this
automatically for all benchmarks. Currently, many settings are fixed and
jfr's output isn't processed but it demonstrates this idea. Finally, the
profiler cannot be executed unless the initial jvm command includes
explicitly the flag "-XX:+UnlockCommercialFeatures".

When jmh terminates you can then open the generated files with Java Mission
Control.

WDYT? Would you find something like that useful?

http://www.di.uoa.gr/~biboudis/cr/jmh/Adding_support_for_a_java_flight_recorder_(-prof_jfr)_profiler_.patch

Cheers,
Aggelos


More information about the jmh-dev mailing list