Profiling of benchmarks with JFR
Millies, Sebastian
Sebastian.Millies at softwareag.com
Wed Sep 2 13:52:58 UTC 2020
Thanks Aleksey.
However, it seems I must modify the classpath somehow? I'm getting "Could not load the main class" exceptions when using -prof jfr.
Here's what I see on the console:
# Run progress: 0,00% complete, ETA 00:01:45
# Fork: 1 of 1
# Preparing profilers: JavaFlightRecorderProfiler
# Warmup Iteration 1: 1795,453 ms/op
# Warmup Iteration 2: 1635,463 ms/op
Iteration 1: <failure>
java.lang.RuntimeException: Error executing: [C:\Program Files\Zulu\zulu-8\jre\bin\java.exe, 6024, JFR.start, name=MyBenchmarkClass.myBenchmark-AverageTime, settings=profile]
Error: Could not find or load main class 6024
at org.openjdk.jmh.profile.JavaFlightRecorderProfiler.execute(JavaFlightRecorderProfiler.java:194)
at org.openjdk.jmh.profile.JavaFlightRecorderProfiler.beforeIteration(JavaFlightRecorderProfiler.java:131)
at org.openjdk.jmh.runner.BenchmarkHandler.startProfilers(BenchmarkHandler.java:261)
at org.openjdk.jmh.runner.BenchmarkHandler.runIteration(BenchmarkHandler.java:334)
at org.openjdk.jmh.runner.BaseRunner.runBenchmark(BaseRunner.java:281)
at org.openjdk.jmh.runner.BaseRunner.runBenchmark(BaseRunner.java:233)
at org.openjdk.jmh.runner.BaseRunner.doSingle(BaseRunner.java:138)
at org.openjdk.jmh.runner.BaseRunner.runBenchmarksForked(BaseRunner.java:75)
at org.openjdk.jmh.runner.ForkedRunner.run(ForkedRunner.java:72)
at org.openjdk.jmh.runner.ForkedMain.main(ForkedMain.java:84)
Interestingly, it doesn't seem to happen during warm-up. I guess the reason is that warm-up iterations don't get profiled, which is totally reasonable.
I'm building with Maven with a pom generated from the archetype, and only have the following dependencies:
<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-core</artifactId>
<version>1.25</version>
</dependency>
<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-generator-annprocess</artifactId>
<version>1.25</version>
<scope>provided</scope>
</dependency>
I'm running under an OpenJDK from Azul:
openjdk version "1.8.0_265"
OpenJDK Runtime Environment (Zulu 8.48.0.53-CA-win64) (build 1.8.0_265-b11)
OpenJDK 64-Bit Server VM (Zulu 8.48.0.53-CA-win64) (build 25.265-b11, mixed mode)
Do I need additional dependencies? Or do I need to use a different OpenJDK?
Regards,
Sebastian
-----Original Message-----
From: Aleksey Shipilev <shade at redhat.com>
Sent: Tuesday, September 1, 2020 11:09 AM
To: Millies, Sebastian <Sebastian.Millies at softwareag.com>; jmh-dev at openjdk.java.net
Subject: Re: Profiling of benchmarks with JFR
On 9/1/20 9:44 AM, Millies, Sebastian wrote:
> can anyone point me to resources, tutorials or other resources where I
> can learn how to profile JMH benchmarks with JFR?
-prof jfr gives you a .jfr file with a recording, which you can then open with Java Mission Control (JMC). The rest is about figuring out what JMC shows you :)
--
Thanks,
-Aleksey
Software AG – Sitz/Registered office: Uhlandstraße 12, 64297 Darmstadt, Germany – Registergericht/Commercial register: Darmstadt HRB 1562 - Vorstand/Management Board: Sanjay Brahmawar (Vorsitzender/Chairman), Dr. Elke Frank, Dr. Matthias Heiden, John Schweitzer, Dr. Stefan Sigg - Aufsichtsratsvorsitzender/Chairman of the Supervisory Board: Karl-Heinz Streibich - http://www.softwareag.com
More information about the jmh-dev
mailing list