Java Code Examples for org.openjdk.jmh.runner.options.TimeValue

The following examples show how to use org.openjdk.jmh.runner.options.TimeValue. 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: FHIR   Source File: FHIRBenchmarkRunner.java    License: Apache License 2.0 6 votes vote down vote up
/**
     * Run without overriding any parameters
     */
    public Collection<RunResult> run() throws RunnerException {
        Options opt = new OptionsBuilder()
                .include(".*" + benchmarkClass.getSimpleName() + ".*")
                .jvmArgsPrepend("-Xms2g", "-Xmx2g")
                .jvmArgsAppend(properties.toArray(new String[properties.size()]))
                .verbosity(VerboseMode.NORMAL)
                .warmupIterations(1)
                .warmupTime(TimeValue.seconds(10))
                .measurementIterations(2)
                .measurementTime(TimeValue.seconds(10))
                .shouldDoGC(true)
                .forks(2)
                .threads(1)
//              .mode(Mode.AverageTime)
                .addProfiler(StackProfiler.class)
                .build();
        return new Runner(opt).run();
    }
 
Example 2
Source Project: FHIR   Source File: FHIRBenchmarkRunner.java    License: Apache License 2.0 6 votes vote down vote up
/**
     * Run and override the 'exampleName' param with the passed fileName
     */
    public Collection<RunResult> run(String fileName) throws RunnerException {
        Options opt = new OptionsBuilder()
                .include(".*" + benchmarkClass.getSimpleName() + ".*")
                .jvmArgsPrepend("-Xms4g", "-Xmx4g")
                .jvmArgsAppend(properties.toArray(new String[properties.size()]))
                .verbosity(VerboseMode.NORMAL)
                .warmupIterations(1)
                .warmupTime(TimeValue.seconds(10))
                .measurementIterations(2)
                .measurementTime(TimeValue.seconds(10))
                .shouldDoGC(false)
                .forks(1)
//              .mode(Mode.AverageTime)
                .addProfiler(StackProfiler.class)
                .param("exampleName", fileName)
                .build();
        return new Runner(opt).run();
    }
 
Example 3
Source Project: FHIR   Source File: FHIRBenchmarkRunner.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Run the benchmark with all the examples in BenchmarkUtil.SPEC_EXAMPLE_NAMES
 */
public Collection<RunResult> runAll() throws RunnerException {
    Options opt = new OptionsBuilder()
            .include(".*" + benchmarkClass.getSimpleName() + ".*")
            .jvmArgsPrepend("-Xms4g", "-Xmx4g")
            .jvmArgsAppend(properties.toArray(new String[properties.size()]))
            .verbosity(VerboseMode.NORMAL)
            .warmupIterations(1)
            .warmupTime(TimeValue.seconds(10))
            .measurementIterations(1)
            .measurementTime(TimeValue.seconds(10))
            .shouldDoGC(true)
            .forks(1)
            .output("results.txt")
            .mode(Mode.SingleShotTime)
            .param("exampleName", BenchmarkUtil.SPEC_EXAMPLE_NAMES.toArray(new String[0])) // https://stackoverflow.com/a/4042464/161022
            .build();
    return new Runner(opt).run();
}
 
Example 4
Source Project: vlingo-http   Source File: BenchmarkTests.java    License: Mozilla Public License 2.0 6 votes vote down vote up
@Test
@Ignore("Ignoring this test in favor of the existing jMeter tests, but keep it for local tests of future refactorings to action matching")
public void launchBenchmark() throws Exception {
  final double expectedMinUsPerOp = 350;

  Options opt = new OptionsBuilder()
    .include(this.getClass().getSimpleName() + "\\.benchmark.*")
    .mode(Mode.AverageTime)
    .timeUnit(TimeUnit.MICROSECONDS)
    .warmupTime(TimeValue.seconds(1))
    .warmupIterations(2)
    .measurementTime(TimeValue.seconds(1))
    .measurementIterations(2)
    .threads(1)
    .forks(1)
    .shouldFailOnError(true)
    .shouldDoGC(true)
    .build();

  RunResult result = new Runner(opt).runSingle();
  double usPerOp = result.getPrimaryResult().getScore();
  assertTrue("µs/matching operation = " + usPerOp + " is higher than " + expectedMinUsPerOp,
    usPerOp < expectedMinUsPerOp);
}
 
Example 5
Source Project: yare   Source File: StandardBenchmarkPerformanceTest.java    License: MIT License 6 votes vote down vote up
private Options getOptions(String id, int complexity) {
    return new OptionsBuilder()
            .include(this.getClass().getName() + ".*")
            .mode(Mode.SampleTime)
            .timeUnit(TimeUnit.MILLISECONDS)
            .warmupTime(TimeValue.seconds(30))
            .warmupIterations(1)
            .measurementTime(TimeValue.seconds(30))
            .measurementIterations(1)
            .threads(2)
            .forks(1)
            .shouldFailOnError(true)
            .shouldDoGC(true)
            .jvmArgs("-server", "-Xms1024M", "-Xmx1024M", "-XX:+UseG1GC", "-Did=" + id, "-Dcomplexity=" + complexity)
            .build();
}
 
Example 6
Source Project: yare   Source File: MultithreadedTest.java    License: MIT License 6 votes vote down vote up
@Test
public void launchBenchmark() throws Exception {
    new Runner(
            new OptionsBuilder().include(MultithreadedTest.class.getSimpleName())
                    .shouldFailOnError(true)
                    .mode(Mode.AverageTime)
                    .timeUnit(TimeUnit.MILLISECONDS)
                    .warmupIterations(2)
                    .warmupTime(TimeValue.seconds(2))
                    .measurementIterations(5)
                    .measurementTime(TimeValue.seconds(10))
                    .threads(Runtime.getRuntime().availableProcessors())
                    .forks(1)
                    .jvmArgs("-server", "-Xms2048M", "-Xmx2048M", "-XX:+UseG1GC")
                    .shouldDoGC(true)
                    .build()
    ).run();
}
 
Example 7
Source Project: yare   Source File: AbstractPerformanceTest.java    License: MIT License 6 votes vote down vote up
@Test
public void runBenchmarks() throws RunnerException {
    Options opt = new OptionsBuilder()
            .include(this.getClass().getSimpleName())
            .mode(Mode.AverageTime)
            .timeUnit(MILLISECONDS)
            .warmupIterations(2)
            .warmupTime(TimeValue.seconds(2))
            .measurementIterations(10)
            .measurementTime(TimeValue.seconds(2))
            .threads(1)
            .warmupForks(0)
            .forks(1)
            .shouldFailOnError(true)
            .shouldDoGC(true)
            .result("benchmarks/performance-results.csv")
            .resultFormat(ResultFormatType.CSV)
            .jvmArgs("-server", "-Xms2048M", "-Xmx2048M", "-XX:+UseG1GC")
            .build();
    new Runner(opt).run();
}
 
Example 8
Source Project: conf4j   Source File: SpringPerformanceBenchmarkTest.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(3))
            .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 9
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 10
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 RunnerException, InterruptedException {
	Client client = new Client();

	for (int i = 0; i < 60; i++) {
		try {
			System.out.println(client.getUser());
			break;
		} catch (Exception e) {
			Thread.sleep(1000);
		}
	}

	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 11
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 {
	Client client = new Client();

	for (int i = 0; i < 60; i++) {
		try {
			System.out.println(client.getUser());
			break;
		} catch (Exception e) {
			Thread.sleep(1000);
		}
	}

	client.close();

	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 12
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 {
    Client client = new Client();

    for (int i = 0; i < 60; i++) {
        try {
            System.out.println(client.getUser());
            break;
        } catch (Exception e) {
            Thread.sleep(1000);
        }
    }

    client.close();

    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 13
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 {
	Client client = new Client();

	for (int i = 0; i < 60; i++) {
		try {
			System.out.println(client.getUser());
			break;
		} catch (Exception e) {
			Thread.sleep(1000);
		}
	}
	
	client.close();

	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 14
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 {
	Client client = new Client();
	System.out.println(client.getUser());
	client.close();

	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 15
public void 
launchBenchmark() throws Exception {

        Options opt = new OptionsBuilder()
            // Specify which benchmarks to run. 
            // You can be more specific if you'd like to run only one benchmark per test.
            .include(this.getClass().getName() + ".*")
            // Set the following options as needed
            .mode (Mode.AverageTime)
            .timeUnit(TimeUnit.MICROSECONDS)
            .warmupTime(TimeValue.seconds(1))
            .warmupIterations(2)
            .measurementTime(TimeValue.seconds(10))
            .measurementIterations(5)
            .threads(1)
            .forks(1)
            .shouldFailOnError(true)
            .shouldDoGC(true)
            //.jvmArgs("-XX:+UnlockDiagnosticVMOptions", "-XX:+PrintInlining")
            //.addProfiler(WinPerfAsmProfiler.class)
            .build();

        new Runner(opt).run();
    }
 
Example 16
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 RunnerException, InterruptedException {
	Client client = new Client();

	for (int i = 0; i < 60; i++) {
		try {
			System.out.println(client.getUser());
			break;
		} catch (Exception e) {
			Thread.sleep(1000);
		}
	}

	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 17
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 RunnerException, InterruptedException {
	Client client = new Client();

	for (int i = 0; i < 60; i++) {
		try {
			System.out.println(client.getUser());
			break;
		} catch (Exception e) {
			Thread.sleep(1000);
		}
	}

	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 18
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 19
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 20
Source Project: tutorials   Source File: BenchmarkManualTest.java    License: MIT License 6 votes vote down vote up
public void
launchBenchmark() throws Exception {

  Options opt = new OptionsBuilder()
    // Specify which benchmarks to run.
    // You can be more specific if you'd like to run only one benchmark per test.
    .include(this.getClass().getName() + ".*")
    // Set the following options as needed
    .mode (Mode.AverageTime)
    .timeUnit(TimeUnit.MICROSECONDS)
    .warmupTime(TimeValue.seconds(1))
    .warmupIterations(2)
    .measurementTime(TimeValue.seconds(1))
    .measurementIterations(2)
    .threads(2)
    .forks(1)
    .shouldFailOnError(true)
    .shouldDoGC(true)
    //.jvmArgs("-XX:+UnlockDiagnosticVMOptions", "-XX:+PrintInlining")
    //.addProfiler(WinPerfAsmProfiler.class)
    .build();

  new Runner(opt).run();


}
 
Example 21
Source Project: datakernel   Source File: DkDirectScopebindBenchmark.java    License: Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) throws RunnerException {
	System.out.println("Running benchmark with specialization " + (SPECIALIZE ? "ON" : "OFF"));

	Options opt = new OptionsBuilder()
			.include(DkDirectScopebindBenchmark.class.getSimpleName())
			.forks(2)
			.warmupIterations(3)
			.warmupTime(TimeValue.seconds(1L))
			.measurementIterations(10)
			.measurementTime(TimeValue.seconds(2L))
			.mode(Mode.AverageTime)
			.timeUnit(TimeUnit.NANOSECONDS)
			.build();

	new Runner(opt).run();
}
 
Example 22
Source Project: sofa-jraft   Source File: RawKVGetBenchmark.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(RawKVGetBenchmark.class.getSimpleName()) //
        .warmupIterations(1) //
        .warmupTime(TimeValue.seconds(10)) //
        .measurementIterations(3) //
        .measurementTime(TimeValue.seconds(10)) //
        .threads(CONCURRENCY) //
        .forks(1) //
        .build();

    new Runner(opt).run();
}
 
Example 23
Source Project: sofa-jraft   Source File: RawKVPutBenchmark.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(RawKVPutBenchmark.class.getSimpleName()) //
        .warmupIterations(1) //
        .warmupTime(TimeValue.seconds(10)) //
        .measurementIterations(3) //
        .measurementTime(TimeValue.seconds(10)) //
        .threads(CONCURRENCY) //
        .forks(1) //
        .build();

    new Runner(opt).run();
}
 
Example 24
Source Project: sofa-jraft   Source File: RawKVApproximateBenchmark.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(RawKVApproximateBenchmark.class.getSimpleName()) //
        .warmupIterations(3) //
        .warmupTime(TimeValue.seconds(10)) //
        .measurementIterations(3) //
        .measurementTime(TimeValue.seconds(10)) //
        .threads(CONCURRENCY) //
        .forks(1) //
        .build();

    new Runner(opt).run();
}
 
Example 25
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 26
Source Project: sofa-jraft   Source File: RheaKVPutBenchmark.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(RheaKVPutBenchmark.class.getSimpleName()) //
        .warmupIterations(1) //
        .warmupTime(TimeValue.seconds(10)) //
        .measurementIterations(3) //
        .measurementTime(TimeValue.seconds(10)) //
        .threads(CONCURRENCY) //
        .forks(1) //
        .build();

    new Runner(opt).run();
}
 
Example 27
Source Project: sofa-jraft   Source File: VarIntsBenchmark.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(VarIntsBenchmark.class.getSimpleName()) //
        .warmupIterations(3) //
        .warmupTime(TimeValue.seconds(10)) //
        .measurementIterations(3) //
        .measurementTime(TimeValue.seconds(10)) //
        .forks(1) //
        .build();

    new Runner(opt).run();
}
 
Example 28
public static void main(String[] args)
    throws Exception {
  Options opt =
      new OptionsBuilder().include(BenchmarkDictionaryCreation.class.getSimpleName()).warmupTime(TimeValue.seconds(5))
          .warmupIterations(2).measurementTime(TimeValue.seconds(5)).measurementIterations(3).forks(1).build();

  new Runner(opt).run();
}
 
Example 29
Source Project: sofa-jraft   Source File: AsciiCodecBenchmark.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(AsciiCodecBenchmark.class.getSimpleName()) //
        .warmupIterations(3) //
        .warmupTime(TimeValue.seconds(10)) //
        .measurementIterations(3) //
        .measurementTime(TimeValue.seconds(10)) //
        .forks(1) //
        .build();

    new Runner(opt).run();
}
 
Example 30
Source Project: sofa-jraft   Source File: Utf8CodecBenchmark.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(Utf8CodecBenchmark.class.getSimpleName()) //
        .warmupIterations(3) //
        .warmupTime(TimeValue.seconds(10)) //
        .measurementIterations(3) //
        .measurementTime(TimeValue.seconds(10)) //
        .forks(1) //
        .build();

    new Runner(opt).run();
}