Simplest way to run benchmark for single class?
Aleksey Shipilev
aleksey.shipilev at oracle.com
Wed Jul 24 05:51:49 PDT 2013
Hi Eugene,
On 07/24/2013 03:59 PM, Eugene Voytitsky wrote:
> I tried to run it from IDEA as app "org.openjdk.jmh.Main -v
> .*JMHSample_11_Loops.*"
> I got:
> No matching benchmarks. Miss-spelled regexp? Use -v for verbose output.
> Benchmarks:
>
> Yes, indeed, I don't have any /META-INF/MicroBenchmarks, so
> MicroBenchmarkList.defaultList() produces empty result.
Have you tried to force compilation first to let JMH generate that for
you? In IDEA, it seems enough to add "Run Maven Goal 'JMH
Samples:install'" before launching the configuration.
> I wonder why main() so coupled with defaultList() (with presence of
> /META-INF/MicroBenchmarks file) :
> Runner runner = new Runner(cmdOptions);
> runner.run(MicroBenchmarkList.defaultList());
The major issue here is that we generate lots of auxiliary code during
the benchmark compilation, and the entry point is different from the
class you have. Hence, it is not enough to just have the name of class
bearing @GMB methods. We may reconsider this going forward.
We also see that running benchmarks from IDE is not a good idea anyway:
we better push users to use the standalone VMs where they control the
invocation precisely.
> I don't want to write any /META-INF/MicroBenchmarks.
> I want to benchmark single class passed as arg to Main.
>
> How to do so?
You might want to execute the standalone run with "-v" and capture the
forked command line. Although it is the internal API and can be changed
without prior notice.
-Aleksey
More information about the jmh-dev
mailing list