Search in sources :

Example 71 with OptionsBuilder

use of org.openjdk.jmh.runner.options.OptionsBuilder in project useful-java-links by Vedenin.

the class ConvertBigStringToInputStreamBenchmark method main.

public static void main(String[] args) throws RunnerException {
    Options opt = new OptionsBuilder().include(ConvertStringToInputStreamBenchmark.class.getSimpleName()).timeUnit(TimeUnit.MICROSECONDS).warmupIterations(5).measurementIterations(50).forks(1).mode(Mode.AverageTime).build();
    new Runner(opt).run();
}
Also used : Options(org.openjdk.jmh.runner.options.Options) Runner(org.openjdk.jmh.runner.Runner) OptionsBuilder(org.openjdk.jmh.runner.options.OptionsBuilder)

Example 72 with OptionsBuilder

use of org.openjdk.jmh.runner.options.OptionsBuilder in project ignite by apache.

the class JmhWaitStategyBenchmark method main.

/**
     * Benchmark runner
     */
public static void main(String[] args) throws RunnerException {
    List<String> policies = Arrays.asList("inc", "dec", "r25", "r50", "r75");
    int[] threads = { 2, 4, 8, 16, 32 };
    List<RunResult> results = new ArrayList<>();
    for (String policy : policies) {
        for (int thread : threads) {
            ChainedOptionsBuilder builder = new OptionsBuilder().jvmArgs().timeUnit(TimeUnit.MILLISECONDS).measurementIterations(10).measurementTime(TimeValue.seconds(20)).warmupIterations(5).warmupTime(TimeValue.seconds(10)).jvmArgs("-Dbench.exp.policy=" + policy).forks(1).threads(thread).mode(Mode.Throughput).include(JmhWaitStategyBenchmark.class.getSimpleName());
            results.addAll(new Runner(builder.build()).run());
        }
    }
    for (RunResult result : results) {
        BenchmarkParams params = result.getParams();
        Collection<String> args1 = params.getJvmArgs();
        for (String s : args1) {
            System.out.print(s.substring(s.length() - 3, s.length()));
            System.out.print(" x ");
        }
        System.out.print(params.getThreads());
        System.out.print("\t\t");
        System.out.println(result.getPrimaryResult().toString());
    }
}
Also used : Runner(org.openjdk.jmh.runner.Runner) ChainedOptionsBuilder(org.openjdk.jmh.runner.options.ChainedOptionsBuilder) ArrayList(java.util.ArrayList) ChainedOptionsBuilder(org.openjdk.jmh.runner.options.ChainedOptionsBuilder) OptionsBuilder(org.openjdk.jmh.runner.options.OptionsBuilder) RunResult(org.openjdk.jmh.results.RunResult) BenchmarkParams(org.openjdk.jmh.infra.BenchmarkParams)

Example 73 with OptionsBuilder

use of org.openjdk.jmh.runner.options.OptionsBuilder in project poi by apache.

the class AddImageBench method main.

public static void main(String[] args) throws RunnerException {
    Options opt = new OptionsBuilder().include(".*" + AddImageBench.class.getSimpleName() + ".*").addProfiler(StackProfiler.class).addProfiler(GCProfiler.class).forks(1).build();
    new Runner(opt).run();
}
Also used : Options(org.openjdk.jmh.runner.options.Options) Runner(org.openjdk.jmh.runner.Runner) OptionsBuilder(org.openjdk.jmh.runner.options.OptionsBuilder) StackProfiler(org.openjdk.jmh.profile.StackProfiler)

Aggregations

OptionsBuilder (org.openjdk.jmh.runner.options.OptionsBuilder)73 Runner (org.openjdk.jmh.runner.Runner)71 Options (org.openjdk.jmh.runner.options.Options)68 StackProfiler (org.openjdk.jmh.profile.StackProfiler)7 ChainedOptionsBuilder (org.openjdk.jmh.runner.options.ChainedOptionsBuilder)4 RunResult (org.openjdk.jmh.results.RunResult)3 File (java.io.File)1 ArrayList (java.util.ArrayList)1 Mode (org.openjdk.jmh.annotations.Mode)1 BenchmarkParams (org.openjdk.jmh.infra.BenchmarkParams)1 GCProfiler (org.openjdk.jmh.profile.GCProfiler)1 Result (org.openjdk.jmh.results.Result)1 RunnerException (org.openjdk.jmh.runner.RunnerException)1 Statistics (org.openjdk.jmh.util.Statistics)1