Java Code Examples for org.openjdk.jmh.results.format.ResultFormatType

The following examples show how to use org.openjdk.jmh.results.format.ResultFormatType. 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: customized-symspell   Source File: SymSpellSearchBenchMark.java    License: MIT License 6 votes vote down vote up
@Test
public void testBenchmarkSearch() throws RunnerException, IOException {
  File file = checkFileAndCreate(SymSpellSearchBenchMark.class.getName());
  Options opt = new OptionsBuilder()
      .include(SymSpellSearchBenchMark.class.getSimpleName())
      .addProfiler(MemoryProfiler.class.getName())
      .resultFormat(ResultFormatType.JSON)
      .result(file.getAbsolutePath())
      .warmupIterations(0)
      .measurementIterations(1)
      .forks(1)
      .build();
  new Runner(opt).run();
  System.out.println("Total Lookup results instance " + totalMatches);

}
 
Example 2
Source Project: customized-symspell   Source File: SymSpellIndexBenchMark.java    License: MIT License 6 votes vote down vote up
@Test
public void testBenchmarkIndex() throws RunnerException, IOException {
  File file = checkFileAndCreate(SymSpellIndexBenchMark.class.getName());
  Options opt = new OptionsBuilder()
      .include(SymSpellIndexBenchMark.class.getSimpleName())
      .addProfiler(MemoryProfiler.class.getName())
      .resultFormat(ResultFormatType.JSON)
      .result(file.getAbsolutePath())
      .warmupIterations(0)
      .measurementIterations(1)
      .forks(1)
      .build();
  new Runner(opt).run();
  System.out.println("Total Lookup results instance " + totalMatches);

}
 
Example 3
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 4
@Test
public void testJmhBenchmarks() throws Exception {
    // number of iterations is kept to a minimum just to verify that the benchmarks work without spending extra
    // time during builds.
    ChainedOptionsBuilder optionsBuilder =
            new OptionsBuilder()
                    .forks(1)
                    .warmupIterations(0)
                    .measurementBatchSize(1)
                    .measurementIterations(1)
                    .shouldFailOnError(true)
                    .result(reportPath)
                    .timeUnit(TimeUnit.MICROSECONDS)
                    .resultFormat(ResultFormatType.JSON);
    new BenchmarkFinder(getClass()).findBenchmarks(optionsBuilder);
    new Runner(optionsBuilder.build()).run();

    assertTrue(Files.exists(Paths.get(reportPath)));
}
 
Example 5
Source Project: hadoop-hdfs-fsimage-exporter   Source File: BenchmarkIT.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void runMicroBenchMark() throws RunnerException {
    new File("target/jmh-report/").mkdirs();
    Options opt = new OptionsBuilder()
            .include(getClass().getName())
            .warmupIterations(2)
            .measurementIterations(10)
            .mode(Mode.AverageTime)
            .timeUnit(TimeUnit.MILLISECONDS)
            .addProfiler(GCProfiler.class)
            .jvmArgs("-server", "-XX:+UseG1GC", "-Xmx256m")
            .shouldDoGC(true)
            .forks(1)
            .resultFormat(ResultFormatType.JSON)
            .result("target/jmh-reports/"+getClass().getSimpleName()+".json")
            .build();

    new Runner(opt).run();
}
 
Example 6
Source Project: jenkins-test-harness   Source File: BenchmarkTest.java    License: MIT License 6 votes vote down vote up
@Test
public void testJmhBenchmarks() throws Exception {
    // create directory for JMH reports
    Path path = Paths.get("target/jmh-reports/");
    Files.createDirectories(path);

    // number of iterations is kept to a minimum just to verify that the benchmarks work without spending extra
    // time during builds.
    ChainedOptionsBuilder optionsBuilder =
            new OptionsBuilder()
                    .forks(1)
                    .warmupIterations(0)
                    .measurementIterations(1)
                    .measurementBatchSize(1)
                    .shouldFailOnError(true)
                    .result("target/jmh-reports/jmh-benchmark-report.json")
                    .timeUnit(TimeUnit.MICROSECONDS)
                    .resultFormat(ResultFormatType.JSON);
    new BenchmarkFinder(getClass()).findBenchmarks(optionsBuilder);
    new Runner(optionsBuilder.build()).run();
}
 
Example 7
Source Project: folder-auth-plugin   Source File: BenchmarkRunner.java    License: MIT License 5 votes vote down vote up
@Test
public void runBenchmarks() throws IOException, RunnerException {
    ChainedOptionsBuilder options = new OptionsBuilder()
                                        .forks(2)
                                        .mode(Mode.AverageTime)
                                        .shouldDoGC(true)
                                        .shouldFailOnError(true)
                                        .result("jmh-report.json")
                                        .resultFormat(ResultFormatType.JSON)
                                        .timeUnit(TimeUnit.MICROSECONDS)
                                        .threads(2);

    new BenchmarkFinder(BenchmarkRunner.class).findBenchmarks(options);
    new Runner(options.build()).run();
}
 
Example 8
Source Project: mica-jmh   Source File: UUIDBenchmark.java    License: MIT License 5 votes vote down vote up
public static void main(String[] args) throws RunnerException {
	Options opts = new OptionsBuilder()
		.include(UUIDBenchmark.class.getSimpleName())
		.warmupIterations(5)
		.measurementIterations(5)
		.jvmArgs("-server")
		.forks(1)
		.resultFormat(ResultFormatType.TEXT)
		.build();
	new Runner(opts).run();
}
 
Example 9
Source Project: mica-jmh   Source File: BeanCopyListBenchmark.java    License: MIT License 5 votes vote down vote up
public static void main(String[] args) throws RunnerException {
	Options opts = new OptionsBuilder()
		.include(BeanCopyListBenchmark.class.getSimpleName())
		.warmupIterations(5)
		.measurementIterations(5)
		.jvmArgs("-server")
		.forks(1)
		.resultFormat(ResultFormatType.TEXT)
		.build();
	new Runner(opts).run();
}
 
Example 10
Source Project: mica-jmh   Source File: BeanCopyBenchmark.java    License: MIT License 5 votes vote down vote up
public static void main(String[] args) throws RunnerException {
	Options opts = new OptionsBuilder()
		.include(BeanCopyBenchmark.class.getSimpleName())
		.warmupIterations(5)
		.measurementIterations(5)
		.jvmArgs("-server")
		.forks(1)
		.resultFormat(ResultFormatType.TEXT)
		.build();
	new Runner(opts).run();
}
 
Example 11
Source Project: mica-jmh   Source File: BeanCopySimpleBenchmark.java    License: 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 12
Source Project: mica-jmh   Source File: BeanCopyMapBenchmark.java    License: 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 13
Source Project: mica-jmh   Source File: BeanCopyConvertBenchmark.java    License: MIT License 5 votes vote down vote up
public static void main(String[] args) throws RunnerException {
	Options opts = new OptionsBuilder()
		.include(BeanCopyConvertBenchmark.class.getSimpleName())
		.warmupIterations(5)
		.measurementIterations(5)
		.jvmArgs("-server")
		.forks(1)
		.resultFormat(ResultFormatType.TEXT)
		.build();
	new Runner(opts).run();
}
 
Example 14
Source Project: mica-jmh   Source File: BeanConvertTest.java    License: MIT License 5 votes vote down vote up
public static void main(String[] args) throws RunnerException {
	Options opts = new OptionsBuilder()
		.include(BeanConvertTest.class.getSimpleName())
		.warmupIterations(5)
		.measurementIterations(5)
		.jvmArgs("-server")
		.forks(1)
		.resultFormat(ResultFormatType.TEXT)
		.build();
	new Runner(opts).run();
}
 
Example 15
Source Project: mica-jmh   Source File: MicaHttpBenchmark.java    License: MIT License 5 votes vote down vote up
public static void main(String[] args) throws RunnerException {
	Options opts = new OptionsBuilder()
		.include(MicaHttpBenchmark.class.getSimpleName())
		.warmupIterations(5)
		.measurementIterations(5)
		.jvmArgs("-server")
		.forks(1)
		.resultFormat(ResultFormatType.TEXT)
		.build();
	new Runner(opts).run();
}
 
Example 16
Source Project: mica-jmh   Source File: DateBenchmark.java    License: MIT License 5 votes vote down vote up
public static void main(String[] args) throws RunnerException {
	Options opts = new OptionsBuilder()
		.include(DateBenchmark.class.getSimpleName())
		.warmupIterations(5)
		.measurementIterations(5)
		.jvmArgs("-server")
		.forks(1)
		.resultFormat(ResultFormatType.TEXT)
		.build();
	new Runner(opts).run();
}
 
Example 17
Source Project: mica-jmh   Source File: DateBenchmarkTest2.java    License: MIT License 5 votes vote down vote up
public static void main(String[] args) throws RunnerException {
	Options opts = new OptionsBuilder()
		.include(DateBenchmarkTest2.class.getSimpleName())
		.warmupIterations(5)
		.measurementIterations(5)
		.jvmArgs("-server")
		.forks(1)
		.resultFormat(ResultFormatType.TEXT)
		.build();
	new Runner(opts).run();
}
 
Example 18
Source Project: mica-jmh   Source File: DateBenchmarkDate.java    License: MIT License 5 votes vote down vote up
public static void main(String[] args) throws RunnerException {
	Options opts = new OptionsBuilder()
		.include(DateBenchmarkDate.class.getSimpleName())
		.warmupIterations(5)
		.measurementIterations(5)
		.jvmArgs("-server")
		.forks(1)
		.resultFormat(ResultFormatType.TEXT)
		.build();
	new Runner(opts).run();
}
 
Example 19
Source Project: mica-jmh   Source File: DateBenchmarkTest1.java    License: MIT License 5 votes vote down vote up
public static void main(String[] args) throws RunnerException {
	Options opts = new OptionsBuilder()
		.include(DateBenchmarkTest1.class.getSimpleName())
		.warmupIterations(5)
		.measurementIterations(5)
		.jvmArgs("-server")
		.forks(1)
		.resultFormat(ResultFormatType.TEXT)
		.build();
	new Runner(opts).run();
}
 
Example 20
Source Project: netty-4.1.22   Source File: AbstractMicrobenchmarkBase.java    License: 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 (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 21
Source Project: articles   Source File: Bench.java    License: Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws RunnerException {
    new Runner(
      new OptionsBuilder()
        .include(Bench.class.getSimpleName())
        .resultFormat(ResultFormatType.JSON)
        .result(System.currentTimeMillis() + ".json")
        .build()).run();
}
 
Example 22
Source Project: articles   Source File: BatchingBenchmark.java    License: Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws RunnerException {
    new Runner(
      new OptionsBuilder()
        .include(BatchingBenchmark.class.getSimpleName())
        .mode(Mode.AverageTime)
        .timeUnit(TimeUnit.MILLISECONDS)
        .resultFormat(ResultFormatType.JSON)
        .result(System.currentTimeMillis() + ".json")
        .warmupIterations(4)
        .measurementIterations(5)
        .forks(1)

        .build()).run();
}
 
Example 23
Source Project: netty4.0.27Learn   Source File: AbstractMicrobenchmark.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void run() throws Exception {
    String className = getClass().getSimpleName();

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

    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);
    }

    new Runner(runnerOptions.build()).run();
}
 
Example 24
public static void main(String[] args) throws RunnerException {
		System.out.println(JmhMapBenchmarks.class.getSimpleName());
		Options opt = new OptionsBuilder()
				.include(
						".*" + JmhMapBenchmarks.class.getSimpleName()
								+ ".(timeInsert)")
				.timeUnit(TimeUnit.NANOSECONDS)
				.forks(0)
				//.warmupMode(WarmupMode.INDI)
				.warmupIterations(0)
				.warmupTime(TimeValue.seconds(1))
				.mode(Mode.AverageTime)
				.measurementIterations(5)
				.param("dataType", "MAP")
				.param("run", "0")
//				.param("run", "1")
//				.param("run", "2")
//				.param("run", "3")
				//.addProfiler(CountingIntegerProfiler.class)
				//.param("producer", "SLEEPING_INTEGER")
				.param("producer", "COUNTING_INTEGER")
				.param("sampleDataSelection", "MATCH").param("size", "1024") // 1048576
				//.param("valueFactoryFactory", "VF_PDB_PERSISTENT_SPECIALIZED")
				.param("valueFactoryFactory", "VF_PDB_PERSISTENT_CURRENT")
				//.param("valueFactoryFactory", "VF_SCALA")
				//.param("valueFactoryFactory", "VF_CLOJURE")
				.resultFormat(ResultFormatType.CSV)
				.result("latest-results-main.csv")
				.build();

		new Runner(opt).run();
	}
 
Example 25
Source Project: tinkerpop   Source File: AbstractBenchmarkBase.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void run() throws Exception {
    final String className = getClass().getSimpleName();

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

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

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

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

    if (getReportDir() != null) {
        final String dtmStr = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
        final String filePath = getReportDir() + className + "-" + dtmStr + ".json";
        final File file = new File(filePath);
        if (file.exists()) {
            file.delete();
        } else {
            file.getParentFile().mkdirs();
            file.createNewFile();
        }

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

    new Runner(runnerOptions.build()).run();
}
 
Example 26
Source Project: t-digest   Source File: TDigestBench.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(".*" + TDigestBench.class.getSimpleName() + ".*")
            .resultFormat(ResultFormatType.CSV)
            .result("overall-results.csv")
            .addProfiler(GCProfiler.class)
            .addProfiler(StackProfiler.class)
            .build();

    new Runner(opt).run();
}
 
Example 27
Source Project: t-digest   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(".*" + Benchmark.class.getSimpleName() + ".*")
            .resultFormat(ResultFormatType.CSV)
            .result("results.csv")
            .addProfiler(GCProfiler.class)
            .addProfiler(StackProfiler.class)
            .build();

    new Runner(opt).run();
}
 
Example 28
Source Project: t-digest   Source File: MergeBench.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(MergeBench.class.getSimpleName())
            .warmupIterations(5)
            .measurementIterations(5)
            .forks(1)
            .resultFormat(ResultFormatType.CSV)
            .addProfiler(StackProfiler.class)
            .build();

    new Runner(opt).run();
}
 
Example 29
Source Project: t-digest   Source File: FloatHistogramBench.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(".*" + FloatHistogramBench.class.getSimpleName() + ".*")
            .resultFormat(ResultFormatType.CSV)
            .result("overall-results.csv")
            .addProfiler(StackProfiler.class)
            .addProfiler(GCProfiler.class)
            .build();

    new Runner(opt).run();
}
 
Example 30
Source Project: t-digest   Source File: ApproxLogBench.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(ApproxLogBench.class.getSimpleName())
            .warmupIterations(5)
            .measurementIterations(5)
            .forks(1)
            .resultFormat(ResultFormatType.CSV)
            .build();

    new Runner(opt).run();
}