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

The following examples show how to use org.openjdk.jmh.runner.options.TimeValue. 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: BenchmarkTests.java    From vlingo-http with 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 #2
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 #3
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 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 #4
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 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 #5
Source File: FHIRBenchmarkRunner.java    From FHIR with 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 #6
Source File: FHIRBenchmarkRunner.java    From FHIR with 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 #7
Source File: FHIRBenchmarkRunner.java    From FHIR with 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 #8
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 #9
Source File: DkDirectScopebindBenchmark.java    From datakernel with 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 #10
Source File: RealDataSerializationBenchmark.java    From RoaringBitmap with Apache License 2.0 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(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 #11
Source File: StandardBenchmarkPerformanceTest.java    From yare with 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 #12
Source File: MultithreadedTest.java    From yare with 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 #13
Source File: AbstractPerformanceTest.java    From yare with 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 #14
Source File: SpringPerformanceBenchmarkTest.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(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 #15
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 #16
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 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 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 {
	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 #18
Source File: BenchmarkManualTest.java    From tutorials with 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 #19
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 {
    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 #20
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 {
	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 #21
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 {
	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 #22
Source File: BenchmarkJunitTests.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Test
public void test() throws RunnerException {
	Options opt = new OptionsBuilder()
			.include("")
			.exclude(ComplexLargeBenchmark.class.getSimpleName())
			.exclude(NativeStoreBenchmark.class.getSimpleName())
			.measurementBatchSize(1)
			.measurementTime(TimeValue.NONE)
			.measurementIterations(1)
			.warmupIterations(0)
			.forks(0)
			.build();

	new Runner(opt).run();
}
 
Example #23
Source File: UnrolledCopierBenchmark.java    From unsafe with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public static void main(String[] args) throws RunnerException {
  Options opt = new OptionsBuilder().include(UnrolledCopierBenchmark.class.getSimpleName())
      .mode(Mode.Throughput)
      .warmupIterations(1)
      .warmupTime(TimeValue.seconds(10))
      .measurementIterations(5) // 5
      .measurementTime(TimeValue.seconds(60))
      .forks(5) // 5
      //.addProfiler(StackProfiler.class)
      //.addProfiler(GCProfiler.class)
      .build();

  new Runner(opt).run();
}
 
Example #24
Source File: HollowPrimaryKeyIndexBenchmark.java    From hollow with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws RunnerException {
    Options opt = new OptionsBuilder()
            .include(HollowPrimaryKeyIndexBenchmark.class.getSimpleName())
            .warmupIterations(5)
            .warmupTime(TimeValue.seconds(1))
            .measurementIterations(1)
            .measurementTime(TimeValue.seconds(3))
            .forks(1)
            .build();
    new Runner(opt).run();
}
 
Example #25
Source File: ArrayListBenchmark.java    From unsafe with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * Runs the ArrayListBenchmarks.
 *
 * @param args command line arguments
 * @throws RunnerException if the Benchmark Runner fails
 */
public static void main(String[] args) throws RunnerException {

  for (String benchmark : benchmarks.keySet()) {
    String[] parts = benchmark.split("-");
    Options opt = new OptionsBuilder()
        .include(ArrayListBenchmark.class.getSimpleName())

        // Warmup, and then run test iterations
        .warmupIterations(2).measurementIterations(5)

        // Each iteration call the test repeatedly for ~60 seconds
        .mode(Mode.AverageTime)
        .warmupTime(TimeValue.seconds(10))
        .measurementTime(TimeValue.seconds(60))

        // The size of the list
        .param("size", "80000000", "20000000", "5000000")
        .param("list", parts[0])
        .param("type", parts[1])

        .forks(1).jvmArgs("-Xmx16g")
        //.addProfiler(MemoryProfiler.class)
        //.addProfiler(StackProfiler.class)
        //.addProfiler(GCProfiler.class)

        .build();

    new Runner(opt).run();
  }
}
 
Example #26
Source File: RiderDataSetBenchmark.java    From database-rider with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws RunnerException {
    new Runner(new OptionsBuilder().
            forks(3).
            threads(4).
            warmupIterations(1).
            warmupForks(1).
            measurementIterations(5).
            include(RiderDataSetBenchmark.class.getSimpleName()).
            measurementTime(TimeValue.milliseconds(300)).
            build()
    ).run();
}
 
Example #27
Source File: BenchmarkOrDocIdIterator.java    From incubator-pinot with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args)
    throws Exception {
  Options opt =
      new OptionsBuilder().include(BenchmarkOrDocIdIterator.class.getSimpleName()).warmupTime(TimeValue.seconds(5))
          .warmupIterations(2).measurementTime(TimeValue.seconds(5)).measurementIterations(3).forks(1).build();

  new Runner(opt).run();
}
 
Example #28
Source File: Cli.java    From java-json-benchmark with MIT License 5 votes vote down vote up
@Override
        public void run() {
            if (libraries == null || libraries.contains("javaxjson")) {
                JsonUtils.printJavaxJsonProvider();
            }

            ChainedOptionsBuilder b = new OptionsBuilder()
                .forks(forks)
                .warmupIterations(warmupIterations)
                .measurementIterations(measurementIterations)
                .measurementTime(new TimeValue(measurementTime, TimeUnit.SECONDS))
                .threads(threads);
//                .addProfiler(StackProfiler.class);

            List<String> includes = includes();
            if (includes.isEmpty()) {
                exit("No tests to run. Check 'info' to see what you can do.");
            }
            for (String i : includes) {
                b.include(i);
            }

            File config = Config.save(this);

            Options opt = b.build();
            try {
                new Runner(opt).run();
            } catch (RunnerException ex) {
                throw new RuntimeException(ex);
            } finally {
                config.delete();
            }
        }
 
Example #29
Source File: BenchmarkQueryEngine.java    From incubator-pinot with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args)
    throws Exception {
  ChainedOptionsBuilder opt =
      new OptionsBuilder().include(BenchmarkQueryEngine.class.getSimpleName()).warmupTime(TimeValue.seconds(30))
          .warmupIterations(4).measurementTime(TimeValue.seconds(30)).measurementIterations(20);

  if (ENABLE_PROFILING) {
    opt = opt.addProfiler(StackProfiler.class,
        "excludePackages=true;excludePackageNames=sun.,java.net.,io.netty.,org.apache.zookeeper.,org.eclipse.jetty.;lines=5;period=1;top=20");
  }

  new Runner(opt.build()).run();
}
 
Example #30
Source File: BenchmarkBootstrap.java    From jvm-serializer with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws RunnerException {
    Options opt = new OptionsBuilder()
            .include(MsgPackCodecTest.class.getSimpleName())
            .include(KryoCodecTest.class.getSimpleName())
            .include(FastJsonCodecTest.class.getSimpleName())
            .include(JdkCodecTest.class.getSimpleName())
            .include(HessianCodecTest.class.getSimpleName())
            .forks(1)
            .measurementIterations(10).measurementTime(new TimeValue(5, TimeUnit.SECONDS))
            .warmupIterations(10).warmupTime(new TimeValue(5, TimeUnit.SECONDS))
            .build();

    new Runner(opt).run();
}