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

The following examples show how to use org.openjdk.jmh.results.format.ResultFormatType. 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: BenchmarkIT.java    From hadoop-hdfs-fsimage-exporter with Apache License 2.0 7 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 #2
Source File: SymSpellSearchBenchMark.java    From customized-symspell with 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 #3
Source File: BenchmarkTest.java    From jenkins-test-harness with 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 #4
Source File: CascJmhBenchmarkStateTest.java    From configuration-as-code-plugin with MIT License 6 votes vote down vote up
@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 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 #6
Source File: SymSpellIndexBenchMark.java    From customized-symspell with 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 #7
Source File: BatchingBenchmark.java    From articles with 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 #8
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 #9
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 #10
Source File: ApproxLogBench.java    From t-digest with 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();
}
 
Example #11
Source File: FloatHistogramBench.java    From t-digest with 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 #12
Source File: MergeBench.java    From t-digest with 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 #13
Source File: Benchmark.java    From t-digest with 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 #14
Source File: TDigestBench.java    From t-digest with 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 #15
Source File: AbstractBenchmarkBase.java    From tinkerpop with 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 #16
Source File: JmhMapBenchmarks.java    From oopsla15-artifact with Eclipse Public License 1.0 5 votes vote down vote up
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 #17
Source File: AbstractMicrobenchmark.java    From netty4.0.27Learn with 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 #18
Source File: BenchmarkRunner.java    From folder-auth-plugin with 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 #19
Source File: BeanCopyBenchmark.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(BeanCopyBenchmark.class.getSimpleName())
		.warmupIterations(5)
		.measurementIterations(5)
		.jvmArgs("-server")
		.forks(1)
		.resultFormat(ResultFormatType.TEXT)
		.build();
	new Runner(opts).run();
}
 
Example #20
Source File: Bench.java    From articles with 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 #21
Source File: UUIDBenchmark.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(UUIDBenchmark.class.getSimpleName())
		.warmupIterations(5)
		.measurementIterations(5)
		.jvmArgs("-server")
		.forks(1)
		.resultFormat(ResultFormatType.TEXT)
		.build();
	new Runner(opts).run();
}
 
Example #22
Source File: BeanCopyListBenchmark.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(BeanCopyListBenchmark.class.getSimpleName())
		.warmupIterations(5)
		.measurementIterations(5)
		.jvmArgs("-server")
		.forks(1)
		.resultFormat(ResultFormatType.TEXT)
		.build();
	new Runner(opts).run();
}
 
Example #23
Source File: AbstractMicrobenchmarkBase.java    From netty-4.1.22 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 (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 #24
Source File: DateBenchmarkTest1.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(DateBenchmarkTest1.class.getSimpleName())
		.warmupIterations(5)
		.measurementIterations(5)
		.jvmArgs("-server")
		.forks(1)
		.resultFormat(ResultFormatType.TEXT)
		.build();
	new Runner(opts).run();
}
 
Example #25
Source File: DateBenchmarkDate.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(DateBenchmarkDate.class.getSimpleName())
		.warmupIterations(5)
		.measurementIterations(5)
		.jvmArgs("-server")
		.forks(1)
		.resultFormat(ResultFormatType.TEXT)
		.build();
	new Runner(opts).run();
}
 
Example #26
Source File: DateBenchmarkTest2.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(DateBenchmarkTest2.class.getSimpleName())
		.warmupIterations(5)
		.measurementIterations(5)
		.jvmArgs("-server")
		.forks(1)
		.resultFormat(ResultFormatType.TEXT)
		.build();
	new Runner(opts).run();
}
 
Example #27
Source File: DateBenchmark.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(DateBenchmark.class.getSimpleName())
		.warmupIterations(5)
		.measurementIterations(5)
		.jvmArgs("-server")
		.forks(1)
		.resultFormat(ResultFormatType.TEXT)
		.build();
	new Runner(opts).run();
}
 
Example #28
Source File: MicaHttpBenchmark.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(MicaHttpBenchmark.class.getSimpleName())
		.warmupIterations(5)
		.measurementIterations(5)
		.jvmArgs("-server")
		.forks(1)
		.resultFormat(ResultFormatType.TEXT)
		.build();
	new Runner(opts).run();
}
 
Example #29
Source File: BeanConvertTest.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(BeanConvertTest.class.getSimpleName())
		.warmupIterations(5)
		.measurementIterations(5)
		.jvmArgs("-server")
		.forks(1)
		.resultFormat(ResultFormatType.TEXT)
		.build();
	new Runner(opts).run();
}
 
Example #30
Source File: BeanCopyConvertBenchmark.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(BeanCopyConvertBenchmark.class.getSimpleName())
		.warmupIterations(5)
		.measurementIterations(5)
		.jvmArgs("-server")
		.forks(1)
		.resultFormat(ResultFormatType.TEXT)
		.build();
	new Runner(opts).run();
}