public static void main(String[] args) throws RunnerException { Options options = new OptionsBuilder() .verbosity(VerboseMode.NORMAL) .threads(getInteger("threads", 1)) .include(".*" + BenchmarkCPUCounters.class.getSimpleName() + ".*") .build(); new Runner(options).run(); } }
@Test public void testCompareQuery() throws SQLException, RunnerException { Options options = new OptionsBuilder() .include(getClass().getName() + ".*") .mode(Mode.SingleShotTime) .timeUnit(TimeUnit.MILLISECONDS) .warmupTime(TimeValue.seconds(5)) .warmupIterations(2) .measurementTime(TimeValue.seconds(10)) .measurementIterations(5) .threads(1) .forks(2) .build(); try { new Runner(options).run(); } catch (NoBenchmarksException ignored) { // expected? only happens from gradle } }
public static void main(String[] args) throws RunnerException { Options opt = new OptionsBuilder() .include(SummaryBenchmark.class.getSimpleName()) .warmupIterations(5) .measurementIterations(4) .threads(4) .forks(1) .build(); new Runner(opt).run(); } }
public static void main(String[] args) throws RunnerException { Options opt = new OptionsBuilder() .include(GaugeBenchmark.class.getSimpleName()) .warmupIterations(5) .measurementIterations(4) .threads(4) .forks(1) .build(); new Runner(opt).run(); } }
public static void main(String[] args) throws RunnerException { Options opt = new OptionsBuilder() .include(CounterBenchmark.class.getSimpleName()) .warmupIterations(5) .measurementIterations(4) .threads(4) .forks(1) .build(); new Runner(opt).run(); } }
optionsBuilder = optionsBuilder .forks(1) .threads(threads) .warmupIterations(10) .measurementIterations(10);
private static void benchmark(int threadCount) throws RunnerException { Options opt = new OptionsBuilder() .include(ConsumeMostlySuccess.class.getSimpleName()) .warmupIterations(10) .measurementIterations(10) .threads(threadCount) .forks(1) .build(); new Runner(opt).run(); }
public static void main(String[] args) throws RunnerException { Options opt = new OptionsBuilder() .include(BaseLineWithoutSynchronization.class.getSimpleName()) .warmupIterations(10) .measurementIterations(10) .threads(1) .forks(1) .build(); new Runner(opt).run(); }
private static void benchmark(int threadCount) throws RunnerException { Options opt = new OptionsBuilder() .include(TryConsumeMostlySuccess.class.getSimpleName()) .warmupIterations(10) .measurementIterations(10) .threads(threadCount) .forks(1) .build(); new Runner(opt).run(); }
public static void main(String[] args) throws RunnerException { Options options = new OptionsBuilder() .include(FalseSharingBenchmark.class.getSimpleName()) .forks(1) .warmupIterations(10) .measurementIterations(10) .threads(2) .timeUnit(TimeUnit.MICROSECONDS) .build(); new Runner(options).run(); } }
public static void main(String[] args) throws RunnerException { Options options = new OptionsBuilder() .verbosity(VerboseMode.NORMAL) .threads(getInteger("threads", 1)) .include(".*" + BenchmarkCPUCounters.class.getSimpleName() + ".*") .build(); new Runner(options).run(); } }
public static void main(String[] args) throws IOException, RunnerException { System.out.println(TEST_CLASSES_REGEX); Options options = new OptionsBuilder() .include(TEST_CLASSES_REGEX) .forks(1) .measurementIterations(5) .measurementTime(TimeValue.milliseconds(100)) .threads(1) .verbosity(VerboseMode.NORMAL) .build(); new Runner(options).run(); //Alternative way to receive parameters via command line and run the benchmarks //Main.main(args); }
.measurementIterations(measurementIterations) .measurementTime(new TimeValue(measurementTime, TimeUnit.SECONDS)) .threads(threads);
public static void main(String[] args) throws RunnerException { Options options = new OptionsBuilder() .verbosity(VerboseMode.NORMAL) .threads(getInteger("threads", 1)) .include(".*" + BenchmarkCPUCounters.class.getSimpleName() + ".*") .build(); new Runner(options).run(); } }
public static void main(String[] args) throws RunnerException { Options options = new OptionsBuilder() .verbosity(VerboseMode.NORMAL) .threads(getInteger("threads", 1)) .include(".*" + BenchmarkCPUCounters.class.getSimpleName() + ".*") .build(); new Runner(options).run(); } }
.include(".*ExecutorBenchmark.*") .forks(jmhParams.get("forks")) .threads(jmhParams.get("producerThreads")) .warmupIterations(jmhParams.get("warmups")) .warmupTime(TimeValue.seconds(jmhParams.get("warmupLength")))
Runner createRunner(JmhConfig jmhConfig) { OptionsBuilder optionsBuilder = new OptionsBuilder(); Optional.ofNullable(jmhConfig.getInclude()).ifPresent(optionsBuilder::include); Optional.ofNullable(jmhConfig.getIncludeWarmup()).ifPresent(optionsBuilder::includeWarmup); Optional.ofNullable(jmhConfig.getExclude()).ifPresent(optionsBuilder::exclude); Optional.ofNullable(jmhConfig.getResult()).map(File::getAbsolutePath).ifPresent(optionsBuilder::result); Optional.ofNullable(jmhConfig.getResultFormat()).ifPresent(optionsBuilder::resultFormat); optionsBuilder .warmupMode(jmhConfig.getWarmupMode()) .warmupForks(jmhConfig.getWarmup().getForks()) .warmupBatchSize(jmhConfig.getWarmup().getBatchSize()) .warmupTime(jmhConfig.getWarmup().getTime()) .warmupIterations(jmhConfig.getWarmup().getIterations()) .mode(jmhConfig.getMode()) .forks(jmhConfig.getMeasurement().getForks()) .measurementBatchSize(jmhConfig.getMeasurement().getBatchSize()) .measurementTime(jmhConfig.getMeasurement().getTime()) .measurementIterations(jmhConfig.getMeasurement().getIterations()) .operationsPerInvocation(jmhConfig.getOperationsPerInvocation()) .threads(jmhConfig.getThreads()) .shouldFailOnError(jmhConfig.isFailOnError()) .shouldDoGC(jmhConfig.isGarbageCollection()) .timeout(jmhConfig.getTimeout()) .timeUnit(jmhConfig.getTimeUnit()) .jvmArgs(jmhConfig.getJvmArgs()); return new SeedJmhRunner(optionsBuilder.build()); } }
@Test public void performHttp11VsHttp20Test() throws Exception { Options opt = new OptionsBuilder() .include(this.getClass().getName() + ".*") .mode(Mode.AverageTime) .timeUnit(TimeUnit.MILLISECONDS) .warmupIterations(WARMUP_ITERATIONS_COUNT) .measurementIterations(MEASUREMENT_ITERATIONS_COUNT) .threads(1) .forks(1) .shouldFailOnError(true) .shouldDoGC(true) .build(); new Runner(opt).run(); }
@Test @Category(Profiling.class) public void performRouterBenchmark() throws Exception { Options opt = new OptionsBuilder() .include(this.getClass().getName() + ".*") .mode(Mode.AverageTime) .mode(Mode.SingleShotTime) .timeUnit(TimeUnit.MILLISECONDS) .warmupIterations(WARMUP_ITERATIONS_COUNT) .measurementIterations(MEASUREMENT_ITERATIONS_COUNT) .threads(1) .forks(1) .shouldFailOnError(true) .shouldDoGC(true) .build(); new Runner(opt).run(); }