Java Code Examples for org.openjdk.jmh.runner.Runner

The following examples show how to use org.openjdk.jmh.runner.Runner. These examples are extracted from open source projects. 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 Project: conf4j   Source File: PerformanceBenchmarkTest.java    License: 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 2
Source Project: turbo-rpc   Source File: RestClientBenchmark.java    License: 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 3
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 4
Source Project: requery   Source File: BenchmarkTest.java    License: 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 5
Source Project: git-client-plugin   Source File: BenchmarkRunner.java    License: 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 6
Source Project: rpc-benchmark   Source File: Client.java    License: 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 7
Source Project: Jupiter   Source File: SerializationBenchmark.java    License: Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws RunnerException {
    Options opt = new OptionsBuilder()
            .include(SerializationBenchmark.class.getSimpleName())
            .build();

    new Runner(opt).run();
}
 
Example 8
Source Project: sofa-jraft   Source File: RheaKVGetBenchmark.java    License: Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws RunnerException {
    Options opt = new OptionsBuilder() //
        .include(RheaKVGetBenchmark.class.getSimpleName()) //
        .warmupIterations(1) //
        .warmupTime(TimeValue.seconds(10)) //
        .measurementIterations(3) //
        .measurementTime(TimeValue.seconds(10)) //
        .threads(BenchmarkUtil.CONCURRENCY) //
        .forks(1) //
        .build();

    new Runner(opt).run();
}
 
Example 9
public static void main(String[] args) throws RunnerException {
  Options opt = new OptionsBuilder()
      .include(".*" + OkHttpSenderBenchmarks.class.getSimpleName() + ".*")
      .build();

  new Runner(opt).run();
}
 
Example 10
Source Project: sdn-rx   Source File: Benchmarks.java    License: Apache License 2.0 5 votes vote down vote up
public static void main(String... args) throws RunnerException, CommandLineOptionException {

		CommandLineOptions commandLineOptions = new CommandLineOptions(args);
		ChainedOptionsBuilder builder = new OptionsBuilder().parent(commandLineOptions)
			.include(Benchmarks.class.getSimpleName())
			.jvmArgsAppend("-ea");

		new Runner(builder.build()).run();
	}
 
Example 11
Source Project: sdn-rx   Source File: Benchmarks.java    License: Apache License 2.0 5 votes vote down vote up
public static void main(String... args) throws RunnerException, CommandLineOptionException {

		CommandLineOptions commandLineOptions = new CommandLineOptions(args);
		ChainedOptionsBuilder builder = new OptionsBuilder().parent(commandLineOptions)
			.include(Benchmarks.class.getSimpleName())
			.jvmArgsAppend("-ea");

		new Runner(builder.build()).run();
	}
 
Example 12
Source Project: jmh-playground   Source File: JMHSample_15_Asymmetric.java    License: Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws RunnerException {
    Options opt = new OptionsBuilder()
            .include(JMHSample_15_Asymmetric.class.getSimpleName())
            .warmupIterations(5)
            .measurementIterations(5)
            .forks(1)
            .build();

    new Runner(opt).run();
}
 
Example 13
Source Project: ignite   Source File: JmhPartitionUpdateCounterBenchmark.java    License: Apache License 2.0 5 votes vote down vote up
/**
 *
 * @param args Args.
 * @throws Exception Exception.
 */
public static void main(String[] args) throws Exception {
    final Options options = new OptionsBuilder()
        .include(JmhPartitionUpdateCounterBenchmark.class.getSimpleName())
        .build();

    new Runner(options).run();
}
 
Example 14
Source Project: SpringBootBucket   Source File: SecondBenchmark.java    License: MIT License 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    Options opt = new OptionsBuilder()
            .include(SecondBenchmark.class.getSimpleName())
            .forks(1)
            .warmupIterations(5)
            .measurementIterations(2)
            .build();
    Collection<RunResult> results =  new Runner(opt).run();
    ResultExporter.exportResult("单线程与多线程求和性能", results, "length", "微秒");
}
 
Example 15
Source Project: qpid-proton-j   Source File: MessageBenchmark.java    License: Apache License 2.0 5 votes vote down vote up
public static void runBenchmark(Class<?> benchmarkClass) throws RunnerException
{
    final Options opt = new OptionsBuilder()
        .include(benchmarkClass.getSimpleName())
        .addProfiler(GCProfiler.class)
        .shouldDoGC(true)
        .warmupIterations(5)
        .measurementIterations(5)
        .forks(1)
        .build();
    new Runner(opt).run();
}
 
Example 16
public static void main(String[] args) throws RunnerException {
    Options opt = new OptionsBuilder()
            .include(PreDictEEBenchmark.class.getSimpleName())
            .warmupIterations(5)
            .measurementIterations(5)
            .forks(1)
            .build();

    new Runner(opt).run();

}
 
Example 17
Source Project: h3-java   Source File: H3SetToMultiPolygonBenchmark.java    License: Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws RunnerException {
    Options opt = new OptionsBuilder()
            .include(H3SetToMultiPolygonBenchmark.class.getSimpleName())
            .forks(1)
            .build();

    new Runner(opt).run();
}
 
Example 18
public static void main(String... args) throws RunnerException, CommandLineOptionException {
    Options opt = new OptionsBuilder()
        .parent(new CommandLineOptions())
        .include(V2DefaultClientCreationBenchmark.class.getSimpleName())
        .addProfiler(StackProfiler.class)
        .build();
    Collection<RunResult> run = new Runner(opt).run();
}
 
Example 19
Source Project: lite-pool   Source File: Benchmark.java    License: Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws RunnerException {
    Options opt = new OptionsBuilder()
            .include(LitePoolBenchmark.class.getSimpleName())
            .include(CommonsPool2Benchmark.class.getSimpleName())
            .warmupIterations(10)
            .measurementIterations(10)
            .forks(1)
            .resultFormat(JSON)
            .result("benchmark-" + System.currentTimeMillis() + ".json")
            .build();
    new Runner(opt).run();
}
 
Example 20
Source Project: friendly-id   Source File: FriendlyIdBenchmark.java    License: Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws RunnerException {
	Options opt = new OptionsBuilder()
			.include(FriendlyIdBenchmark.class.getSimpleName())
			.build();

	new Runner(opt).run();
}
 
Example 21
public static void main(String[] args)
        throws RunnerException
{
    Options options = new OptionsBuilder()
            .verbosity(VerboseMode.NORMAL)
            .include(".*" + BenchmarkHashAndStreamingAggregationOperators.class.getSimpleName() + ".*")
            .build();

    new Runner(options).run();
}
 
Example 22
public static void main(String[] args) throws RunnerException {
  Options opt = new OptionsBuilder()
      .addProfiler("gc")
      .include(".*" + MutableSpanBenchmarks.class.getSimpleName() + ".*")
      .build();

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

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

  new Runner(opt).run();
}
 
Example 25
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();
}
 
Example 26
Source Project: rdf4j   Source File: Main.java    License: 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("")

			// .addProfiler("stack", "lines=20;period=1;top=20")
			.build();

	new Runner(opt).run();
}
 
Example 27
Source Project: hollow   Source File: HashCodesBenchmark.java    License: Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws RunnerException {
    Options opt = new OptionsBuilder()
            .include(HashCodesBenchmark.class.getSimpleName())
            .warmupIterations(5)
            .warmupTime(TimeValue.seconds(1))
            .measurementIterations(1)
            .measurementTime(TimeValue.seconds(3))
            .forks(1)
            .build();
    new Runner(opt).run();
}
 
Example 28
Source Project: rpc-benchmark   Source File: Client.java    License: Apache License 2.0 5 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();
}
 
Example 29
public static void main(String[] args) throws Exception {
	new Runner(
		new OptionsBuilder()
			.include(LegacyTransmuterBenchmark.class.getName() + ".*")
			.param("entityCount", "1024", "4096")
			.build())
	.run();
}
 
Example 30
Source Project: rdf4j   Source File: Main.java    License: 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("")

//			.addProfiler("stack", "lines=20;period=1;top=20")
				.build();

		new Runner(opt).run();
	}