Running benchmark with main method from the generated jar
Luis IBANEZ
luis.ibanez at univ-nantes.fr
Wed Apr 2 09:58:28 UTC 2014
Hi,
I coded a benchmark (jmh 0.5.5) and I used the API in a main method to
compute some custom stats, in a similar way than the GA code sample [0].
This works fine from the IDE, but from the standalone microbenchmarks.jar
it seems that I can only execute the methods annotated as @MicroBenchmarks
(that's what I infer after using the EXTRA verbose mode, it only show me
the methods).
I worked-around that by doing:
java -cp microbenchmarks.jar mypackage/mysubpack/MyClassBenchmark
But that means I lose all the nice command line options provided with the
jar.
I tried using a Properties file, but:
1/ The option parsing is up to me (I still have not checked how to reuse
whatever option parsing jmh uses though)
2/ I also tried to set other parameters (path to the data used), but I
need to hardwire the location of the settings file as it seems that the
method annotated as Trial is executed even before the main (I thought it
was injected just after the call to Runner.run)
Short version of the question: How do I execute code sample [0] from the
generated jar while maintaining the settings control?
Thanks in advance,
Luis.
[0]
http://hg.openjdk.java.net/code-tools/jmh/file/3b57fecd61bf/jmh-samples/src/main/java/org/openjdk/jmh/samples/JMHSample_25_API_GA.java
More information about the jmh-dev
mailing list