I want to start have a look at JMH and I'm failing to run benchmarks due some reasons. Let me explain what I tried:
- Setup a maven project in Eclipse
Define pom.xml like:
Downloaded some official JMH examples. As example I choosed which is pretty simple and a good place to start: http://hg.openjdk.java.net/code-tools/jmh/file/0c58dc4fcf17/jmh-samples/src/main/java/org/openjdk/jmh/samples/JMHSample_01_HelloWorld.java
- Right mouse click > Run As > Java Application
However this produces the output:
Exception in thread "main" No benchmarks to run; check the include/exclude regexps.
at org.openjdk.jmh.runner.Runner.run(Runner.java:155)
at org.openjdk.jmh.samples.JMHSample_01_HelloWorld.main(JMHSample_01_HelloWorld.java:90)
I have googled and it seems the above example should work, but it is not the case for me. I also tried to solve the issue by reading but this seems not working for me:
- "No matching benchmarks" when running JMH from main in eclipse
I tried to move the generated class manually to /META-INF/MicroBenchmarks however this produces following error:
Exception in thread "main" java.lang.IllegalStateException: Mismatched format for the line: JMHSample_01_HelloWorld.class at org.openjdk.jmh.runner.BenchmarkRecord.<init>(BenchmarkRecord.java:92) at org.openjdk.jmh.runner.MicroBenchmarkList.find(MicroBenchmarkList.java:133) at org.openjdk.jmh.runner.Runner.run(Runner.java:150) at JMHSample_01_HelloWorld.main(JMHSample_01_HelloWorld.java:80)
It seems like the JMH should produce some valid lines in /META-INF/MicroBenchmarks - meaning in this folder there should no generated java class files, correct?
Can anyone help me to find the mistake? Thank you.