Search in sources :

Example 6 with RunResult

use of org.openjdk.jmh.results.RunResult in project cassandra by apache.

the class BatchStatementBench method main.

public static void main(String... args) throws Exception {
    Options opts = new OptionsBuilder().include(".*" + BatchStatementBench.class.getSimpleName() + ".*").jvmArgs("-server").forks(1).mode(Mode.Throughput).addProfiler(GCProfiler.class).build();
    Collection<RunResult> records = new Runner(opts).run();
    for (RunResult result : records) {
        Result r = result.getPrimaryResult();
        System.out.println("API replied benchmark score: " + r.getScore() + " " + r.getScoreUnit() + " over " + r.getStatistics().getN() + " iterations");
    }
}
Also used : BatchQueryOptions(org.apache.cassandra.cql3.BatchQueryOptions) QueryOptions(org.apache.cassandra.cql3.QueryOptions) Options(org.openjdk.jmh.runner.options.Options) GCProfiler(org.openjdk.jmh.profile.GCProfiler) Runner(org.openjdk.jmh.runner.Runner) RunResult(org.openjdk.jmh.results.RunResult) OptionsBuilder(org.openjdk.jmh.runner.options.OptionsBuilder) RunResult(org.openjdk.jmh.results.RunResult) Result(org.openjdk.jmh.results.Result)

Example 7 with RunResult

use of org.openjdk.jmh.results.RunResult in project cassandra by apache.

the class MutationBench method main.

public static void main(String... args) throws Exception {
    Options opts = new OptionsBuilder().include(".*" + MutationBench.class.getSimpleName() + ".*").jvmArgs("-server").forks(1).mode(Mode.Throughput).addProfiler(StackProfiler.class).build();
    Collection<RunResult> records = new Runner(opts).run();
    for (RunResult result : records) {
        Result r = result.getPrimaryResult();
        System.out.println("API replied benchmark score: " + r.getScore() + " " + r.getScoreUnit() + " over " + r.getStatistics().getN() + " iterations");
    }
}
Also used : Options(org.openjdk.jmh.runner.options.Options) Runner(org.openjdk.jmh.runner.Runner) RunResult(org.openjdk.jmh.results.RunResult) OptionsBuilder(org.openjdk.jmh.runner.options.OptionsBuilder) StackProfiler(org.openjdk.jmh.profile.StackProfiler) RunResult(org.openjdk.jmh.results.RunResult) Result(org.openjdk.jmh.results.Result)

Example 8 with RunResult

use of org.openjdk.jmh.results.RunResult 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 9 with RunResult

use of org.openjdk.jmh.results.RunResult in project engineblock by engineblock.

the class SysPerfBaseliner method runBenchmarks.

private Collection<RunResult> runBenchmarks() {
    // File jmhOut = File.createTempFile("jmh", "out");
    // These are broken out simply to provide more friendly feedback to users.
    Map<String, Class<?>> namedTests = new LinkedHashMap<>();
    namedTests.put("nanotime", SysBenchMethodNanoTime.class);
    namedTests.put("parknanos", SysBenchMethodParkNanos.class);
    namedTests.put("sleep", SysBenchMethodThreadSleep.class);
    Collection<RunResult> results = new ArrayList<>();
    namedTests.forEach((n, c) -> {
        try {
            String logfile = Files.createTempFile("jmh_" + n, ".log").toString();
            Options options = new OptionsBuilder().forks(1).include(c.getSimpleName()).output(logfile).build();
            logger.info("running microbench for " + n + ", for about 20 seconds; details in " + logfile);
            RunResult runResult = new Runner(options).runSingle();
            results.add(runResult);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    });
    return results;
}
Also used : Options(org.openjdk.jmh.runner.options.Options) Runner(org.openjdk.jmh.runner.Runner) ArrayList(java.util.ArrayList) RunResult(org.openjdk.jmh.results.RunResult) OptionsBuilder(org.openjdk.jmh.runner.options.OptionsBuilder) LinkedHashMap(java.util.LinkedHashMap)

Aggregations

RunResult (org.openjdk.jmh.results.RunResult)9 Runner (org.openjdk.jmh.runner.Runner)8 OptionsBuilder (org.openjdk.jmh.runner.options.OptionsBuilder)6 Options (org.openjdk.jmh.runner.options.Options)5 ArrayList (java.util.ArrayList)3 Result (org.openjdk.jmh.results.Result)3 File (java.io.File)2 BenchmarkParams (org.openjdk.jmh.infra.BenchmarkParams)2 PerformanceResults (com.palantir.atlasdb.performance.PerformanceResults)1 LinkedHashMap (java.util.LinkedHashMap)1 TreeSet (java.util.TreeSet)1 BatchQueryOptions (org.apache.cassandra.cql3.BatchQueryOptions)1 QueryOptions (org.apache.cassandra.cql3.QueryOptions)1 BeforeAll (org.junit.jupiter.api.BeforeAll)1 GCProfiler (org.openjdk.jmh.profile.GCProfiler)1 StackProfiler (org.openjdk.jmh.profile.StackProfiler)1 NoBenchmarksException (org.openjdk.jmh.runner.NoBenchmarksException)1 ProfilersFailedException (org.openjdk.jmh.runner.ProfilersFailedException)1 RunnerException (org.openjdk.jmh.runner.RunnerException)1 ChainedOptionsBuilder (org.openjdk.jmh.runner.options.ChainedOptionsBuilder)1