Multi-package benchmarks: package names 'merged' in the result table

Dmitry Vyazelenko vyazelenko at yahoo.com
Mon Aug 11 22:07:39 UTC 2014


Hi,

When using JMH with benchmarks located in multiple/different benchmarks
the results are incorrectly merged together.

Here are some benchmarks from multiple packages:

package com.some.even.longer.word;

import org.openjdk.jmh.annotations.Benchmark;

public class SomeEvenMoreWeirdBenchmark {
    @Benchmark
    public void baseline() {
    }
}


package my.sample.pkg;

import org.openjdk.jmh.annotations.Benchmark;

public class MySampleBenchmark {
    @Benchmark
    public void baseline() {
    }
}


package test.jmh;

import org.openjdk.jmh.annotations.Benchmark;

public class TestJmhBenchmark {
    @Benchmark
    public void baseline() {
    }
}


When I execute benchmarks I get the following results:
java -jar target/benchmarks.jar -f 1 -wi 0 -i 1
Benchmark                                                                  Mode  Samples           Score  Score error  Units
t.j.TestJmhBenchmark.baseline.word.SomeEvenMoreWeirdBenchmark.baseline    thrpt        1  3464644276.067          NaN  ops/s
t.j.TestJmhBenchmark.baseline.baseline                                    thrpt        1  3454747731.105          NaN  ops/s
t.j.TestJmhBenchmark.baseline                                             thrpt        1  3409380706.050          NaN  ops/s

So instead of using package name from every benchmark class it seems that
"test.jmh.TestJmhBenchmark" is used as prefix for all benchmarks which is wrong!


Best regards,
Dmitry Vyazelenko


More information about the jmh-dev mailing list