Search in sources :

Example 1 with BenchmarkFinder

use of jenkins.benchmark.jmh.BenchmarkFinder in project configuration-as-code-plugin by jenkinsci.

the class BenchmarkRunner method runJmhBenchmarks.

@Test
public void runJmhBenchmarks() throws Exception {
    ChainedOptionsBuilder options = new OptionsBuilder().mode(Mode.AverageTime).warmupIterations(2).timeUnit(TimeUnit.MICROSECONDS).threads(2).forks(2).shouldFailOnError(true).shouldDoGC(true).resultFormat(ResultFormatType.JSON).result("jmh-report.json");
    BenchmarkFinder bf = new BenchmarkFinder(getClass());
    bf.findBenchmarks(options);
    new Runner(options.build()).run();
}
Also used : Runner(org.openjdk.jmh.runner.Runner) ChainedOptionsBuilder(org.openjdk.jmh.runner.options.ChainedOptionsBuilder) OptionsBuilder(org.openjdk.jmh.runner.options.OptionsBuilder) ChainedOptionsBuilder(org.openjdk.jmh.runner.options.ChainedOptionsBuilder) BenchmarkFinder(jenkins.benchmark.jmh.BenchmarkFinder) Test(org.junit.Test)

Example 2 with BenchmarkFinder

use of jenkins.benchmark.jmh.BenchmarkFinder in project configuration-as-code-plugin by jenkinsci.

the class CascJmhBenchmarkStateTest method testJmhBenchmarks.

@Test
public void testJmhBenchmarks() throws Exception {
    // number of iterations is kept to a minimum just to verify that the benchmarks work without spending extra
    // time during builds.
    ChainedOptionsBuilder optionsBuilder = new OptionsBuilder().forks(1).warmupIterations(0).measurementBatchSize(1).measurementIterations(1).shouldFailOnError(true).result(reportPath).timeUnit(TimeUnit.MICROSECONDS).resultFormat(ResultFormatType.JSON);
    new BenchmarkFinder(getClass()).findBenchmarks(optionsBuilder);
    new Runner(optionsBuilder.build()).run();
    assertTrue(Files.exists(Paths.get(reportPath)));
}
Also used : Runner(org.openjdk.jmh.runner.Runner) ChainedOptionsBuilder(org.openjdk.jmh.runner.options.ChainedOptionsBuilder) OptionsBuilder(org.openjdk.jmh.runner.options.OptionsBuilder) ChainedOptionsBuilder(org.openjdk.jmh.runner.options.ChainedOptionsBuilder) BenchmarkFinder(jenkins.benchmark.jmh.BenchmarkFinder) Test(org.junit.Test)

Aggregations

BenchmarkFinder (jenkins.benchmark.jmh.BenchmarkFinder)2 Test (org.junit.Test)2 Runner (org.openjdk.jmh.runner.Runner)2 ChainedOptionsBuilder (org.openjdk.jmh.runner.options.ChainedOptionsBuilder)2 OptionsBuilder (org.openjdk.jmh.runner.options.OptionsBuilder)2