Running JMH Runner from inside the source code?

Behrooz N nobeh5 at gmail.com
Mon Feb 3 03:23:30 PST 2014


Thank you. This concludes what I wanted to understand. I think I will
continue to build an artifact from my benchmark module and run that using a
Maven goal or as an independent executable JAR to perform the benchmarks.


On Mon, Feb 3, 2014 at 12:20 PM, Aleksey Shipilev <
aleksey.shipilev at oracle.com> wrote:

> On 02/03/2014 03:15 PM, Behrooz N wrote:
> > Thanks for the complete explanation.
> >
> > To finalize an understanding for me: so I cannot simply inside my IDE
> > (e.g. eclipse), right-click on the following piece and say "Run as Java
> > Application"
> >
> > |    public static void main(String[] args) throws RunnerException {
> >         Options options = new
> OptionsBuilder().include(".*").exclude(".*openjdk.*")
> >                 .warmupIterations(1000).measurementIterations(100000)
> >                 .verbosity(VerboseMode.EXTRA).build();
> >         new Runner(options).run();
> >     }
>
> You can, if your IDE compiles the classes and invokes the annotation
> processors along the way -- this will generate the microbenchmark list.
> My IntelliJ IDEA does that perfectly well. Other IDEs may require
> calling "mvn compile" before invoking the run.
>
> > Based on the Maven archetype, it is required that I build an artifact
> > from my artifact that may have the above |main| method and then run the
> > benchmark through above that is actually a simpler version. Is this
> correct?
>
> Come again? You generally need a full compile session for the project
> holding your benchmarks, as this will generate the microbenchmark list.
> After that, you may invoke the JMH in any way you want.
>
> -Aleksey.
>



-- 
-- Behrooz Nobakht


More information about the jmh-dev mailing list