From Sebastian.Millies at softwareag.com Tue Sep 1 07:44:20 2020 From: Sebastian.Millies at softwareag.com (Millies, Sebastian) Date: Tue, 1 Sep 2020 07:44:20 +0000 Subject: Profiling of benchmarks with JFR Message-ID: Hello there, can anyone point me to resources, tutorials or other resources where I can learn how to profile JMH benchmarks with JFR? (I haven't much experience with profiling. What I did so far when I wanted to profile an application was to connect to the Java process with Java Mission Control, or run it inside the IDE with a plugin, but obviously for benchmarks those approaches won't work.) Regards, Sebastian 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 From shade at redhat.com Tue Sep 1 09:09:20 2020 From: shade at redhat.com (Aleksey Shipilev) Date: Tue, 1 Sep 2020 11:09:20 +0200 Subject: Profiling of benchmarks with JFR In-Reply-To: References: Message-ID: <30d8b8b1-892c-6a8d-dc34-fa1163278012@redhat.com> 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 From Sebastian.Millies at softwareag.com Wed Sep 2 13:52:58 2020 From: Sebastian.Millies at softwareag.com (Millies, Sebastian) Date: Wed, 2 Sep 2020 13:52:58 +0000 Subject: Profiling of benchmarks with JFR In-Reply-To: <30d8b8b1-892c-6a8d-dc34-fa1163278012@redhat.com> References: <30d8b8b1-892c-6a8d-dc34-fa1163278012@redhat.com> Message-ID: 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: 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: org.openjdk.jmh jmh-core 1.25 org.openjdk.jmh jmh-generator-annprocess 1.25 provided 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 Sent: Tuesday, September 1, 2020 11:09 AM To: Millies, Sebastian ; 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 From shade at redhat.com Wed Sep 2 14:25:25 2020 From: shade at redhat.com (Aleksey Shipilev) Date: Wed, 2 Sep 2020 16:25:25 +0200 Subject: Profiling of benchmarks with JFR In-Reply-To: References: <30d8b8b1-892c-6a8d-dc34-fa1163278012@redhat.com> Message-ID: On 9/2/20 3:52 PM, Millies, Sebastian wrote: > Iteration 1: > > 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 This is the Windows-specific bug: it should call jcmd.exe, not java.exe. It happens because path replacement looks for "/", not for "\". I'll fix it... -- Thanks, -Aleksey From shade at redhat.com Wed Sep 2 15:27:31 2020 From: shade at redhat.com (Aleksey Shipilev) Date: Wed, 2 Sep 2020 17:27:31 +0200 Subject: Profiling of benchmarks with JFR In-Reply-To: References: <30d8b8b1-892c-6a8d-dc34-fa1163278012@redhat.com> Message-ID: <046f94fa-9573-d13d-ff7a-494d5cbc0c48@redhat.com> On 9/2/20 4:25 PM, Aleksey Shipilev wrote: > On 9/2/20 3:52 PM, Millies, Sebastian wrote: >> Iteration 1: >> >> 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 > This is the Windows-specific bug: it should call jcmd.exe, not java.exe. It happens because path > replacement looks for "/", not for "\". I'll fix it... This is fixed with: https://bugs.openjdk.java.net/browse/CODETOOLS-7902763 https://hg.openjdk.java.net/code-tools/jmh/rev/523c524305e2 Tell me if you can test it with self-built 1.26-SNAPSHOT. I would probably release it is 1.25.2 soon. -- Thanks, -Aleksey From shade at redhat.com Wed Sep 2 15:26:05 2020 From: shade at redhat.com (shade at redhat.com) Date: Wed, 02 Sep 2020 15:26:05 +0000 Subject: hg: code-tools/jmh: 7902763: JFR profiler does not work on Windows Message-ID: <202009021526.082FQ5WC028039@aojmv0008.oracle.com> Changeset: 523c524305e2 Author: shade Date: 2020-09-02 17:20 +0200 URL: https://hg.openjdk.java.net/code-tools/jmh/rev/523c524305e2 7902763: JFR profiler does not work on Windows ! jmh-core/src/main/java/org/openjdk/jmh/profile/JavaFlightRecorderProfiler.java From Sebastian.Millies at softwareag.com Wed Sep 2 18:25:11 2020 From: Sebastian.Millies at softwareag.com (Millies, Sebastian) Date: Wed, 2 Sep 2020 18:25:11 +0000 Subject: Profiling of benchmarks with JFR In-Reply-To: <046f94fa-9573-d13d-ff7a-494d5cbc0c48@redhat.com> References: <30d8b8b1-892c-6a8d-dc34-fa1163278012@redhat.com> <046f94fa-9573-d13d-ff7a-494d5cbc0c48@redhat.com> Message-ID: <6a891f833f96454d86ce6aef930650b2@softwareag.com> Thanks, 1.26-SNAPSHOT works. -----Original Message----- From: Aleksey Shipilev Sent: Wednesday, September 2, 2020 5:28 PM To: Millies, Sebastian ; jmh-dev at openjdk.java.net Subject: Re: Profiling of benchmarks with JFR On 9/2/20 4:25 PM, Aleksey Shipilev wrote: > On 9/2/20 3:52 PM, Millies, Sebastian wrote: >> Iteration 1: >> >> 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 > This is the Windows-specific bug: it should call jcmd.exe, not > java.exe. It happens because path replacement looks for "/", not for "\". I'll fix it... This is fixed with: https://linkprotect.cudasvc.com/url?a=https://bugs.openjdk.java.net/browse/CODETOOLS-7902763&c=E%2C10%2C6oOTWP5GdCKWni0CrOAKweS6bvEOWkEyAGoMzR2zhdonapBNSeNzlobCd58/KFJutqG0yH6KkXe2FzA/&typo=1&know=0 https://linkprotect.cudasvc.com/url?a=https://hg.openjdk.java.net/code-tools/jmh/rev/523c524305e2&c=E%2C10%2CXf43awo%2Bv4saDUp%2BSkcehIUonEKuMSu%2Bssq3mO5GuZygh8MupYE%2BvlFkR5hRZjkCp3YdKbTvSAp0%2BHkG&typo=1&know=0 Tell me if you can test it with self-built 1.26-SNAPSHOT. I would probably release it is 1.25.2 soon. -- 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 From shade at redhat.com Thu Sep 3 05:41:34 2020 From: shade at redhat.com (Aleksey Shipilev) Date: Thu, 3 Sep 2020 07:41:34 +0200 Subject: JMH 1.25.1 and 1.25.2 Message-ID: Hi, JMH 1.25.1 and 1.25.2 were released with a two quick profiler fixes that solve the specific use case problems. 1.25.1: 7902759: perfasm: always check maybeAddress before calling parseAddress 1.25.2: 7902763: JFR profiler does not work on Windows If you have trouble with either of these profilers, consider bumping the versions. Enjoy! -- Thanks, -Aleksey From shade at redhat.com Thu Sep 3 05:43:42 2020 From: shade at redhat.com (Aleksey Shipilev) Date: Thu, 3 Sep 2020 07:43:42 +0200 Subject: Profiling of benchmarks with JFR In-Reply-To: <6a891f833f96454d86ce6aef930650b2@softwareag.com> References: <30d8b8b1-892c-6a8d-dc34-fa1163278012@redhat.com> <046f94fa-9573-d13d-ff7a-494d5cbc0c48@redhat.com> <6a891f833f96454d86ce6aef930650b2@softwareag.com> Message-ID: <57e4f7de-335c-c441-d876-0f3cae5508dc@redhat.com> On 9/2/20 8:25 PM, Millies, Sebastian wrote: > Thanks, 1.26-SNAPSHOT works. Now released as 1.25.2. -- Thanks, -Aleksey From gunnar at hibernate.org Sun Sep 20 10:14:24 2020 From: gunnar at hibernate.org (Gunnar Morling) Date: Sun, 20 Sep 2020 12:14:24 +0200 Subject: Profiling with dtraceasm fails Message-ID: Hi, I'm trying to run JMH with -prof dtraceasm on macOS, but it fails with the following exception: Processing profiler results: DTraceAsmProfiler Exception in thread "main" java.lang.IllegalStateException: [] at org.openjdk.jmh.profile.DTraceAsmProfiler.afterTrial(DTraceAsmProfiler.java:92) at org.openjdk.jmh.runner.Runner.runSeparate(Runner.java:688) at org.openjdk.jmh.runner.Runner.runBenchmarks(Runner.java:571) at org.openjdk.jmh.runner.Runner.internalRun(Runner.java:323) at org.openjdk.jmh.runner.Runner.run(Runner.java:209) at org.openjdk.jmh.Main.main(Main.java:71) Unfortunately, there's no more info in the logs (also with -v EXTRA). Any suggestions on getting to the grounds of this? I'm quite new to this, so might well be I'm doing some stupid mistake. Thanks, --Gunnar From shade at redhat.com Fri Sep 25 11:31:14 2020 From: shade at redhat.com (Aleksey Shipilev) Date: Fri, 25 Sep 2020 13:31:14 +0200 Subject: Profiling with dtraceasm fails In-Reply-To: References: Message-ID: <5a8a757f-fcb5-3b95-d565-c7e4afbda8f0@redhat.com> Hi, On 9/20/20 12:14 PM, Gunnar Morling wrote: > Processing profiler results: DTraceAsmProfiler Exception in thread "main" > java.lang.IllegalStateException: [] > at > org.openjdk.jmh.profile.DTraceAsmProfiler.afterTrial(DTraceAsmProfiler.java:92) > at org.openjdk.jmh.runner.Runner.runSeparate(Runner.java:688) > at org.openjdk.jmh.runner.Runner.runBenchmarks(Runner.java:571) > at org.openjdk.jmh.runner.Runner.internalRun(Runner.java:323) > at org.openjdk.jmh.runner.Runner.run(Runner.java:209) > at org.openjdk.jmh.Main.main(Main.java:71) > > Unfortunately, there's no more info in the logs (also with -v EXTRA). Any > suggestions on getting to the grounds of this? I'm quite new to this, so > might well be I'm doing some stupid mistake. The profiler code (and dtrace support) in Mac OS is flaky. It might be simpler to debug straight at your machine. To do that, you can checkout the JMH source code, build it, and run any sample benchmark with -prof dtraceasm: $ https://github.com/openjdk/jmh $ cd jmh $ mvn clean install -DskipTests -pl jmh-samples -am $ java -jar jmh-samples/target/benchmarks.jar Hello -w 1s -r 1s -wi 5 -i 5 -f 1 -prof dtraceasm And then... you hack in the diagnostic messages. Looking at the call trace, I would start from following what happens in DTraceAsmProfiler.afterTrial. Utils.destroy must have resulted in something that exited with non-zero exit code, but nothing diagnostic was printed. It would be interesting to follow-up what exactly happened. -- Thanks, -Aleksey From duke at openjdk.java.net Mon Sep 28 17:24:01 2020 From: duke at openjdk.java.net (duke) Date: Mon, 28 Sep 2020 17:24:01 GMT Subject: git: openjdk/jmh: Add .jcheck/conf (#4) Message-ID: Changeset: 9f5b9903 Author: Erik Duveblad Committer: GitHub Date: 2020-09-28 19:23:44 +0000 URL: https://git.openjdk.java.net/jmh/commit/9f5b9903 Add .jcheck/conf (#4) + .jcheck/conf