Running JMH Runner from inside the source code?

Behrooz N nobeh5 at gmail.com
Mon Feb 3 02:47:34 PST 2014


Thanks for the explanation.

The dependency on jmh-samples is only for studying intentions to get to
know better how to use JMH.

Now, this rises another questions for me. I noticed how
META-INF/MicroBenchmarks is used at JMH. So, my question is that do I need
to also have such a file in my resources folder? This files seems to be
using a specific format which I do not find any document for. And, my
understanding so far is that I only need to have jmh-core and use Runner
API, is that correct?


On Mon, Feb 3, 2014 at 11:33 AM, Aleksey Shipilev <
aleksey.shipilev at oracle.com> wrote:

> On 02/03/2014 02:26 PM, Behrooz N wrote:
> > Please find the output log here:
> > https://gist.github.com/nobeh/15d2a3ccdbfc5ae75659
>
> Thanks.
>
> It seems like JMH is not aware about AppMicroBenchmark whatsoever, and
> instead seems to know about JMH Samples only. I wonder if the
> microbenchmark list from jmh-samples JAR just overrides the one
> generated for your project.
>
> Is there a reason you depend on jmh-samples? The dependency on jmh-core
> should be enough. If you indeed need the dependency on jmh-samples, then
> you should merge the microbenchmark lists, like e.g. by adding the
> relevant <transformer> to maven-shade-plugin:
>
> <plugin>
>     <groupId>org.apache.maven.plugins</groupId>
>     <artifactId>maven-shade-plugin</artifactId>
>     <version>1.5</version>
>     <executions>
>         <execution>
>             <phase>package</phase>
>             <goals>
>                 <goal>shade</goal>
>             </goals>
>             <configuration>
>                 <finalName>microbenchmarks</finalName>
>                 <transformers>
>                     <transformer
>
> implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
>                         <mainClass>org.openjdk.jmh.Main</mainClass>
>                     </transformer>
>                     <transformer
>
> implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
>                         <resource>META-INF/MicroBenchmarks</resource>
>                     </transformer>
>                 </transformers>
>             </configuration>
>         </execution>
>     </executions>
> </plugin>
>
>
> -Aleksey.
>



-- 
-- Behrooz Nobakht


More information about the jmh-dev mailing list