@BenchmarkMethodChart doesn't work

125 views
Skip to first unread message

FredPJ

unread,
May 17, 2013, 11:13:19 AM5/17/13
to junit-be...@googlegroups.com
Hi all.
I'm trying to use @BenchmarkMethodChart like this:

@AxisRange(min = 0, max = 1)
@BenchmarkMethodChart(filePrefix = "benchmark-barchart")
public class MyBenchmarkWithBarChartTest {
        @Rule
        public BenchmarkRule benchmarkRun = new BenchmarkRule();

        @BenchmarkOptions(benchmarkRounds = 10, warmupRounds = 5, callgc = false, clock = Clock.REAL_TIME, concurrency = 4)
        @Test
        public void hashMap() throws Exception {
             ...
       }

In the output I can see :
MyBenchmarkWithBarChartTest.hashMap: [measured 10 out of 15 rounds, threads: 4 (physical processors: 2)]
 round: 1.41 [+- 0.53], round.block: 0.00 [+- 0.00], round.gc: 0.00 [+- 0.00], GC.calls: 10, GC.time: 3.34, time.total: 6.19, time.warmup: 2.04, time.bench: 4.15

But there is no html page generated, can you tell me what could be the reason ?


Thanks

Dawid Weiss

unread,
May 17, 2013, 3:15:08 PM5/17/13
to junit-be...@googlegroups.com
You need to pass H2 (database) consumer to the BenchmarkRule. The
charts are generated by the H2 consumer only (because it has
persistent history of runs). Check out source code (tests); for
example:

static final File dbFile = new File(RepeatedTestSlave.class.getName());
static final File dbFileFull = new File(dbFile.getName() + ".h2.db");
static final File chartsDir = new File("tmp-subdir");

private static H2Consumer h2consumer;

@Rule
public TestRule benchmarkRun = new BenchmarkRule(h2consumer);

@BeforeClass
public static void checkFile() throws SQLException
{
Common.deleteDir(chartsDir);
chartsDir.mkdir();

h2consumer = new H2Consumer(dbFile, chartsDir, null);
}

Dawid
> --
> You received this message because you are subscribed to the Google Groups
> "JUnitBenchmarks: Performance Benchmarking for JUnit4" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to junit-benchmar...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

FredPJ

unread,
May 21, 2013, 5:55:26 AM5/21/13
to junit-be...@googlegroups.com
Thanks that works fine now.

Fred.
Reply all
Reply to author
Forward
0 new messages