org.openjdk.jmh.runner.Runner Java Examples

The following examples show how to use org.openjdk.jmh.runner.Runner. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Client.java    From rpc-benchmark with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
		Options opt = new OptionsBuilder()//
				.include(Client.class.getSimpleName())//
				.warmupIterations(3)//
				.warmupTime(TimeValue.seconds(10))//
				.measurementIterations(3)//
				.measurementTime(TimeValue.seconds(10))//
				.threads(CONCURRENCY)//
				.forks(1)//
				.build();

		new Runner(opt).run();
//		HproseTcpClient client = new HproseTcpClient("tcp://127.0.0.1:8080");
//		UserService userService = client.useService(UserService.class);
//		System.out.println(userService.existUser("1"));
	}
 
Example #2
Source File: PerformanceBenchmarkTest.java    From conf4j with MIT License 6 votes vote down vote up
@Test
public void launchBenchmark() throws Exception {
    Options opt = new OptionsBuilder()
            .include(this.getClass().getName() + ".*")
            .mode(Mode.SampleTime)
            .timeUnit(TimeUnit.MICROSECONDS)
            .warmupIterations(1)
            .warmupTime(TimeValue.seconds(1))
            .measurementIterations(1)
            .measurementTime(TimeValue.seconds(5))
            .threads(2)
            .forks(0)
            .syncIterations(true)
            .shouldFailOnError(true)
            .shouldDoGC(false)
            .jvmArgs("-Xms1G", "-Xmx1G", "-XX:MaxGCPauseMillis=10", "-XX:GCPauseIntervalMillis=100")
            .build();
    new Runner(opt).run();
}
 
Example #3
Source File: BenchmarkRunner.java    From git-client-plugin with MIT License 6 votes vote down vote up
@Test
    public void runJmhBenchmarks() throws Exception {
        ChainedOptionsBuilder options = new OptionsBuilder()
                .mode(Mode.AverageTime) // Performance metric is Average time (ms per operation)
                .warmupIterations(5) // Used to warm JVM before executing benchmark tests
                .measurementIterations(5)
                .timeUnit(TimeUnit.MILLISECONDS)
                .threads(2) // TODO: Increase the number of threads and measure performance
                .forks(2)   // Need to increase more forks to get more observations, increases precision.
                .shouldFailOnError(true) // Will stop forking of JVM as soon as there is a compilation error
                .shouldDoGC(true) // do GC between measurement iterations
                .output("jmh-report.json");
//                .resultFormat(ResultFormatType.JSON) // store the results in a file called jmh-report.json
//                .result("jmh-report.json");

        BenchmarkFinder bf = new BenchmarkFinder(getClass());
        bf.findBenchmarks(options);
        new Runner(options.build()).run();
    }
 
Example #4
Source File: RestClientBenchmark.java    From turbo-rpc with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
	ResourceLeakDetector.setLevel(Level.DISABLED);
	// CtClass.debugDump = "d:/debugDump";

	// RestClientBenchmark clientBenchmark = new RestClientBenchmark();
	// System.out.println(clientBenchmark.createUser());
	// clientBenchmark.close();

	Options opt = new OptionsBuilder()//
			.include(RestClientBenchmark.class.getSimpleName())//
			.warmupIterations(5)//
			.measurementIterations(5)//
			.threads(CONCURRENCY)//
			.forks(1)//
			.build();

	new Runner(opt).run();
}
 
Example #5
Source File: BenchmarkTest.java    From requery with Apache License 2.0 6 votes vote down vote up
@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
    }
}
 
Example #6
Source File: ConvertInputStreamToStringBenchmark.java    From java_in_examples with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    ConvertInputStreamToStringBenchmark test = new ConvertInputStreamToStringBenchmark();
    System.out.println();
    System.out.println("1. apacheToInputStream : " + test.test1_apacheToInputStream().length());
    System.out.println("2. guavaCharStreams : " + test.test2_guavaCharStreams().length());
    System.out.println("3. jdkScanner : " + test.test3_jdkScanner().length());
    System.out.println("4. jdkJava8 : " + test.test4_jdkJava8().length());
    System.out.println("5. jdkJava8parallel : " + test.test5_jdkJava8parallel().length());
    System.out.println("6. inputStreamReaderAndStringBuilder : " + test.test6_inputStreamReaderAndStringBuilder().length());
    System.out.println("7. apacheStringWriterAndIOUtilsCopy : " + test.test7_apacheStringWriterAndIOUtilsCopy().length());
    System.out.println("8. readByteArrayOutputStream : " + test.test8_readByteArrayOutputStream().length());
    System.out.println("9. bufferedReaderReadLine : " + test.test9_bufferedReaderReadLine().length());
    System.out.println("10. bufferedInputStreamAndByteArrayOutputStream : " + test.test10_bufferedInputStreamAndByteArrayOutputStream().length());
    System.out.println("11. inputStreamReadAndStringBuilder : " + test.test11_inputStreamReadAndStringBuilder().length());


    System.out.println();

    Options opt = new OptionsBuilder()
            .include(ConvertInputStreamToStringBenchmark.class.getSimpleName())
            .build();

    new Runner(opt).run();
}
 
Example #7
Source File: RollupBenchmark.java    From notification with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
  new Runner(
          new OptionsBuilder()
              .include(RollupBenchmark.class.getSimpleName())
              .forks(1)
              .warmupIterations(5)
              .measurementIterations(5)
              .build())
      .run();
}
 
Example #8
Source File: BroadcastBenchmark.java    From j360-tools with Apache License 2.0 5 votes vote down vote up
public static void main(String args[]) throws Exception{
    Options opt = new OptionsBuilder()
            .include(BroadcastBenchmark.class.getSimpleName())
            .forks(1)
            .warmupIterations(10) //预热次数
            .measurementIterations(10) //真正执行次数
            .build();

    new Runner(opt).run();
}
 
Example #9
Source File: SmoothlyDecayingRollingCounterPerOperationBenchmark.java    From rolling-metrics with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws RunnerException {
    Options opt = new OptionsBuilder()
            .include(((Class) SmoothlyDecayingRollingCounterPerOperationBenchmark.class).getSimpleName())
            .warmupIterations(5)
            .measurementIterations(5)
            .threads(4)
            .forks(1)
            .build();
    try {
        new Runner(opt).run();
    } catch (RunnerException e) {
        throw new RuntimeException(e);
    }
}
 
Example #10
Source File: BlockingPartitionBenchmark.java    From flink-benchmarks with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args)
		throws RunnerException {
	Options options = new OptionsBuilder()
			.verbosity(VerboseMode.NORMAL)
			.include(".*" + BlockingPartitionBenchmark.class.getCanonicalName() + ".*")
			.build();

	new Runner(options).run();
}
 
Example #11
Source File: JMHSample_34_SafeLooping.java    From jmh-playground with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws RunnerException {
    Options opt = new OptionsBuilder()
            .include(JMHSample_34_SafeLooping.class.getSimpleName())
            .warmupIterations(5)
            .measurementIterations(5)
            .forks(3)
            .build();

    new Runner(opt).run();
}
 
Example #12
Source File: BenchmarkMurmur3Hash128.java    From slice with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args)
        throws RunnerException
{
    Options options = new OptionsBuilder()
            .verbosity(VerboseMode.NORMAL)
            .include(".*" + BenchmarkMurmur3Hash128.class.getSimpleName() + ".*")
            .build();

    new Runner(options).run();
}
 
Example #13
Source File: BenchmarkGeometryAggregations.java    From presto with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args)
        throws Exception
{
    new BenchmarkGeometryAggregations().verify();

    Options options = new OptionsBuilder()
            .verbosity(VerboseMode.NORMAL)
            .include(".*" + BenchmarkGeometryAggregations.class.getSimpleName() + ".*")
            .build();

    new Runner(options).run();
}
 
Example #14
Source File: NettyClientH1NonTlsBenchmark.java    From aws-sdk-java-v2 with Apache License 2.0 5 votes vote down vote up
public static void main(String... args) throws Exception {
    Options opt = new OptionsBuilder()
        .include(NettyClientH1NonTlsBenchmark.class.getSimpleName())
        .addProfiler(StackProfiler.class)
        .build();
    Collection<RunResult> run = new Runner(opt).run();
}
 
Example #15
Source File: BenchmarkUtils.java    From panda with Apache License 2.0 5 votes vote down vote up
public static void run(Class<?> clazz) throws RunnerException {
    Options options = new OptionsBuilder()
            .include(clazz.getName())
            .build();

    Runner runner = new Runner(options);
    runner.run();
}
 
Example #16
Source File: Main.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public static void main(String[] args) throws RunnerException {
	Options opt = new OptionsBuilder().include("")
			.forks(1)
			.build();

	new Runner(opt).run();
}
 
Example #17
Source File: Counters.java    From spectator with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws RunnerException {
  Options opt = new OptionsBuilder()
      .include(".*")
      .forks(1)
      .build();
  new Runner(opt).run();
}
 
Example #18
Source File: BenchmarkJsonToArrayCast.java    From presto with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args)
        throws Exception
{
    // assure the benchmarks are valid before running
    BenchmarkData data = new BenchmarkData();
    data.setup();
    new BenchmarkJsonToArrayCast().benchmark(data);

    Options options = new OptionsBuilder()
            .verbosity(VerboseMode.NORMAL)
            .include(".*" + BenchmarkJsonToArrayCast.class.getSimpleName() + ".*")
            .warmupMode(WarmupMode.BULK_INDI)
            .build();
    new Runner(options).run();
}
 
Example #19
Source File: Benchmark.java    From motif with Apache License 2.0 5 votes vote down vote up
/**
 * Main method to execute benchmarks.
 */
public static void main(String[] args) throws RunnerException {
  Options opt = new OptionsBuilder()
      .include(FactorialBenchmark.class.getSimpleName())
      .include(FizzBuzzBenchmark.class.getSimpleName())
      .forks(1)
      .build();

  new Runner(opt).run();
}
 
Example #20
Source File: BenchmarkPagesSort.java    From presto with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args)
        throws RunnerException
{
    Options options = new OptionsBuilder()
            .verbosity(VerboseMode.NORMAL)
            .include(".*" + BenchmarkPagesSort.class.getSimpleName() + ".*")
            .build();

    new Runner(options).run();
}
 
Example #21
Source File: GarmadonSerializationRegistryBenchmark.java    From garmadon with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws RunnerException {
    Options opt = new OptionsBuilder()
            .include(GarmadonSerializationRegistryBenchmark.class.getSimpleName())
            .build();

    new Runner(opt).run();
}
 
Example #22
Source File: TracingApplicationEventListenerAdapterBenchmarks.java    From brave with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws RunnerException {
  Options opt = new OptionsBuilder()
    .include(".*" + TracingApplicationEventListenerAdapterBenchmarks.class.getSimpleName())
    .build();

  new Runner(opt).run();
}
 
Example #23
Source File: VirtualMemoryBenchmark.java    From questdb with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws RunnerException {
    Options opt = new OptionsBuilder()
            .include(VirtualMemoryBenchmark.class.getSimpleName())
            .warmupIterations(5)
            .measurementIterations(5)
            .forks(1)
            .build();

    new Runner(opt).run();
}
 
Example #24
Source File: FastUtilTypeSpecificBenchmarkUnitTest.java    From tutorials with MIT License 5 votes vote down vote up
public static void main(String... args) throws RunnerException {
  Options opts = new OptionsBuilder()
          .include(".*")
          .warmupIterations(1)
          .measurementIterations(2)
          .jvmArgs("-Xms2g", "-Xmx2g")
          .shouldDoGC(true)
          .forks(1)
          .build();

  new Runner(opts).run();
}
 
Example #25
Source File: BenchmarkRoundFunction.java    From presto with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args)
        throws Exception
{
    Options options = new OptionsBuilder()
            .verbosity(VerboseMode.NORMAL)
            .include(".*" + BenchmarkRoundFunction.class.getSimpleName() + ".*")
            .build();
    new Runner(options).run();
}
 
Example #26
Source File: BenchmarkReorderInterconnectedJoins.java    From presto with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args)
        throws RunnerException
{
    Options options = new OptionsBuilder()
            .verbosity(VerboseMode.NORMAL)
            .include(".*" + BenchmarkReorderInterconnectedJoins.class.getSimpleName() + ".*")
            .build();

    new Runner(options).run();
}
 
Example #27
Source File: BeanCopyMapBenchmark.java    From mica-jmh with MIT License 5 votes vote down vote up
public static void main(String[] args) throws RunnerException {
	Options opts = new OptionsBuilder()
		.include(BeanCopyMapBenchmark.class.getSimpleName())
		.warmupIterations(5)
		.measurementIterations(5)
		.jvmArgs("-server")
		.forks(1)
		.resultFormat(ResultFormatType.TEXT)
		.build();
	new Runner(opts).run();
}
 
Example #28
Source File: OkHttpClientBenchmarks.java    From brave with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws RunnerException {
  Options opt = new OptionsBuilder()
    .include(".*" + OkHttpClientBenchmarks.class.getSimpleName() + ".*")
    .build();

  new Runner(opt).run();
}
 
Example #29
Source File: QMapWriteLongBenchmark.java    From questdb with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws RunnerException {
    Options opt = new OptionsBuilder()
            .include(QMapWriteLongBenchmark.class.getSimpleName())
            .warmupIterations(5)
            .measurementIterations(5)
            .forks(1)
            .build();

    new Runner(opt).run();
}
 
Example #30
Source File: BenchmarkMapCopy.java    From presto with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args)
        throws Exception
{
    // assure the benchmarks are valid before running
    BenchmarkData data = new BenchmarkData();
    data.setup();
    new BenchmarkMapCopy().benchmarkMapCopy(data);

    Options options = new OptionsBuilder()
            .verbosity(VerboseMode.NORMAL)
            .include(".*" + BenchmarkMapCopy.class.getSimpleName() + ".*")
            .build();
    new Runner(options).run();
}