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

The following examples show how to use org.openjdk.jmh.runner.options.OptionsBuilder. 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: 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 #2
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 #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 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 #4
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 #5
Source File: Client.java    From rpc-benchmark with 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 #6
Source File: StringBuilderBenchmarkTest.java    From JavaBase with MIT License 5 votes vote down vote up
@Test
public void test() throws RunnerException {
  Options options = new OptionsBuilder()
      .include(StringBuilderBenchmark.class.getSimpleName())
      .output("/tmp/Benchmark.log").build();
  new Runner(options).run();
}
 
Example #7
Source File: CalculatorBenchmark.java    From datakernel with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws RunnerException {
	Options opt = new OptionsBuilder()
			.include(CalculatorBenchmark.class.getSimpleName())
			.forks(2)
			.warmupIterations(3)
			.warmupTime(TimeValue.seconds(1L))
			.measurementIterations(5)
			.measurementTime(TimeValue.seconds(2L))
			.mode(Mode.AverageTime)
			.timeUnit(TimeUnit.NANOSECONDS)
			.build();

	new Runner(opt).run();
}
 
Example #8
Source File: BenchmarkRBACModelSingle.java    From jcasbin with Apache License 2.0 5 votes vote down vote up
public static void main(String args[]) throws RunnerException {
    Options opt = new OptionsBuilder()
        .include(BenchmarkRBACModelSingle.class.getName())
        .exclude("Pref")
        .warmupIterations(3)
        .measurementIterations(3)
        .addProfiler(GCProfiler.class)
        .forks(1)
        .build();
    new Runner(opt).run();
}
 
Example #9
Source File: BenchmarkGetPartitionsSample.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(".*" + BenchmarkGetPartitionsSample.class.getSimpleName() + ".*")
            .build();
    new Runner(options).run();
}
 
Example #10
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 #11
Source File: HashMapBenchmark.java    From tutorials with MIT License 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    Options options = new OptionsBuilder()
            .include(HashMapBenchmark.class.getSimpleName()).threads(1)
            .forks(1).shouldFailOnError(true)
            .shouldDoGC(true)
            .jvmArgs("-server").build();
    new Runner(options).run();
}
 
Example #12
Source File: MethodInoveBenchmark.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(MethodInoveBenchmark.class.getSimpleName())
            .forks(1)
            .warmupIterations(10) //预热次数
            .measurementIterations(10) //真正执行次数
            .build();

    new Runner(opt).run();
}
 
Example #13
Source File: JMHSample_17_SyncIterations.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_17_SyncIterations.class.getSimpleName())
            .warmupIterations(1)
            .measurementIterations(20)
            .threads(Runtime.getRuntime().availableProcessors()*16)
            .forks(1)
            .syncIterations(true) // try to switch to "false"
            .build();

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

    new Runner(opt).run();
}
 
Example #15
Source File: FrameWriterBenchmark.java    From qpid-proton-j with 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
Source File: FindCountOfOccurrencesBenchmark.java    From java_in_examples with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws RunnerException {
    Options opt = new OptionsBuilder()
            .include(FindCountOfOccurrencesBenchmark.class.getSimpleName())
            .build();

    new Runner(opt).run();
}
 
Example #17
Source File: BenchmarkGSetFiltering.java    From NNAnalytics with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws RunnerException {
  Options opt =
      new OptionsBuilder()
          .include(".*" + BenchmarkGSetFiltering.class.getSimpleName() + ".*")
          .warmupIterations(5)
          .measurementIterations(5)
          .addProfiler(MemoryProfiler.class)
          .addProfiler(GCProfiler.class)
          .forks(1)
          .build();
  new Runner(opt).run();
}
 
Example #18
Source File: ConvertStringToInputStreamBenchmark.java    From java_in_examples with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws RunnerException {
    Options opt = new OptionsBuilder()
            .include(ConvertStringToInputStreamBenchmark.class.getSimpleName())
            .build();

    new Runner(opt).run();
}
 
Example #19
Source File: JerseyServerBenchmarks.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(".*" + JerseyServerBenchmarks.class.getSimpleName() + ".*")
    .build();

  new Runner(opt).run();
}
 
Example #20
Source File: V1ClientCreationBenchmark.java    From aws-sdk-java-v2 with Apache License 2.0 5 votes vote down vote up
public static void main(String... args) throws RunnerException, CommandLineOptionException {
    Options opt = new OptionsBuilder()
        .parent(new CommandLineOptions())
        .include(V1ClientCreationBenchmark.class.getSimpleName())
        .addProfiler(StackProfiler.class)
        .build();
    Collection<RunResult> run = new Runner(opt).run();
}
 
Example #21
Source File: RheaKVGetBenchmark.java    From sofa-jraft with 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 #22
Source File: BeanCopySimpleBenchmark.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(BeanCopySimpleBenchmark.class.getSimpleName())
		.warmupIterations(5)
		.measurementIterations(5)
		.jvmArgs("-server")
		.forks(1)
		.resultFormat(ResultFormatType.TEXT)
		.build();
	new Runner(opts).run();
}
 
Example #23
Source File: SIMDBenchmark.java    From yuzhouwan with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    Options opt = new OptionsBuilder()
            .include(SIMDBenchmark.class.getSimpleName())
            .forks(1)
            .jvmArgsAppend(
                    "-XX:-UseSuperWord",
                    "-XX:+UnlockDiagnosticVMOptions",
                    "-XX:CompileCommand=print,*SIMDBenchmark.bitshift")
            .warmupIterations(5)
            .measurementIterations(10)
            .threads(1)
            .build();
    new Runner(opt).run();
}
 
Example #24
Source File: ToolsBenchmark.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(ToolsBenchmark.class.getSimpleName())
            .forks(1)
            .warmupIterations(2) //预热次数
            .measurementIterations(2) //真正执行次数
            .build();

    new Runner(opt).run();
}
 
Example #25
Source File: ArrayListBenchmark.java    From tutorials with MIT License 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    Options options = new OptionsBuilder()
            .include(ArrayListBenchmark.class.getSimpleName()).threads(3)
            .forks(1).shouldFailOnError(true)
            .shouldDoGC(true)
            .jvmArgs("-server").build();
    new Runner(options).run();
}
 
Example #26
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();
}
 
Example #27
Source File: BenchmarkArraySort.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 BenchmarkArraySort().arraySort(data);

    Options options = new OptionsBuilder()
            .verbosity(VerboseMode.NORMAL)
            .include(".*" + BenchmarkArraySort.class.getSimpleName() + ".*")
            .build();
    new Runner(options).run();
}
 
Example #28
Source File: AbstractMicrobenchmarkBase.java    From hpack with Apache License 2.0 5 votes vote down vote up
protected ChainedOptionsBuilder newOptionsBuilder() throws Exception {
    String className = getClass().getSimpleName();

    ChainedOptionsBuilder runnerOptions = new OptionsBuilder()
            .include(".*" + className + ".*")
            .jvmArgs(jvmArgs());

    if (getWarmupIterations() > 0) {
        runnerOptions.warmupIterations(getWarmupIterations());
    }

    if (getMeasureIterations() > 0) {
        runnerOptions.measurementIterations(getMeasureIterations());
    }

    if (getForks() > 0) {
        runnerOptions.forks(getForks());
    }

    if (getReportDir() != null) {
        String filePath = getReportDir() + className + ".json";
        File file = new File(filePath);
        if (file.exists()) {
            file.delete();
        } else {
            file.getParentFile().mkdirs();
            file.createNewFile();
        }

        runnerOptions.resultFormat(ResultFormatType.JSON);
        runnerOptions.result(filePath);
    }

    return runnerOptions;
}
 
Example #29
Source File: ChronicleQueueMicrobench.java    From Chronicle-Queue with Apache License 2.0 5 votes vote down vote up
private ChainedOptionsBuilder newOptionsBuilder() {
        String className = getClass().getSimpleName();

        final ChainedOptionsBuilder runnerOptions = new OptionsBuilder()
                .include(".*" + className + ".*")
                .jvmArgs(BASE_JVM_ARGS)
                .jvmArgsAppend(jvmArgs()
                );

        if (getWarmupIterations() > 0) {
            runnerOptions.warmupIterations(getWarmupIterations());
        }

        if (getMeasureIterations() > 0) {
            runnerOptions.measurementIterations(getMeasureIterations());
        }

        if (null != getReportDir()) {
            String filePath = getReportDir() + className + ".json";
            File file = new File(filePath);
            if (file.exists()) {
                file.delete();
            } else {
                file.getParentFile().mkdirs();
//                file.createNewFile();
            }

            runnerOptions.resultFormat(ResultFormatType.JSON);
            runnerOptions.result(filePath);
        }

        return runnerOptions;
    }
 
Example #30
Source File: LogBenchmark.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(LogBenchmark.class.getSimpleName())
            .warmupIterations(5)
            .measurementIterations(5)
            .addProfiler("gc")
            .forks(1)
            .build();

    new Runner(opt).run();
}