Search in sources :

Example 1 with RunResult

use of org.openjdk.jmh.results.RunResult in project h2o-3 by h2oai.

the class H2OResultFormat method main.

/**
   * Copy of {@link org.openjdk.jmh.Main#main(java.lang.String[])}
   *
   * @param args command line parameters
   */
public static void main(String[] args) {
    // Try to run benchmark and collect results
    try {
        CommandLineOptions cmdOptions = new CommandLineOptions(args);
        Runner runner = new Runner(cmdOptions);
        Collection<RunResult> results = null;
        try {
            results = runner.run();
            // Bench code passed so report results
            if (H2O_UBENCH_REPORT_FILE != null) {
                // Create an output directory
                File ubenchReportFile = new File(H2O_UBENCH_REPORT_FILE);
                getResultFormater(ubenchReportFile).writeOut(results);
            }
        } catch (NoBenchmarksException e) {
            System.err.println("No matching benchmarks. Miss-spelled regexp?");
            if (cmdOptions.verbosity().orElse(Defaults.VERBOSITY) != VerboseMode.EXTRA) {
                System.err.println("Use " + VerboseMode.EXTRA + " verbose mode to debug the pattern matching.");
            } else {
                runner.list();
            }
            System.exit(1);
        } catch (ProfilersFailedException e) {
            // This is not exactly an error, set non-zero exit code
            System.err.println(e.getMessage());
            System.exit(1);
        } catch (RunnerException e) {
            System.err.print("ERROR: ");
            e.printStackTrace(System.err);
            System.exit(1);
        }
    } catch (CommandLineOptionException e) {
        System.err.println("Error parsing command line:");
        System.err.println(" " + e.getMessage());
        System.exit(1);
    }
}
Also used : Runner(org.openjdk.jmh.runner.Runner) CommandLineOptionException(org.openjdk.jmh.runner.options.CommandLineOptionException) CommandLineOptions(org.openjdk.jmh.runner.options.CommandLineOptions) RunnerException(org.openjdk.jmh.runner.RunnerException) NoBenchmarksException(org.openjdk.jmh.runner.NoBenchmarksException) ProfilersFailedException(org.openjdk.jmh.runner.ProfilersFailedException) RunResult(org.openjdk.jmh.results.RunResult) File(java.io.File)

Example 2 with RunResult

use of org.openjdk.jmh.results.RunResult in project presto by prestodb.

the class HiveFileFormatBenchmark method main.

public static void main(String[] args) throws Exception {
    Options opt = new OptionsBuilder().include(".*\\." + HiveFileFormatBenchmark.class.getSimpleName() + ".*").jvmArgsAppend("-Xmx4g", "-Xms4g", "-XX:+UseG1GC").build();
    Collection<RunResult> results = new Runner(opt).run();
    for (RunResult result : results) {
        Statistics inputSizeStats = result.getSecondaryResults().get("inputSize").getStatistics();
        Statistics outputSizeStats = result.getSecondaryResults().get("outputSize").getStatistics();
        double compressionRatio = 1.0 * inputSizeStats.getSum() / outputSizeStats.getSum();
        String compression = result.getParams().getParam("compression");
        String fileFormat = result.getParams().getParam("fileFormat");
        String dataSet = result.getParams().getParam("dataSet");
        System.out.printf("  %-10s  %-30s  %-10s  %-25s  %2.2f  %10s ± %11s (%5.2f%%) (N = %d, \u03B1 = 99.9%%)\n", result.getPrimaryResult().getLabel(), dataSet, compression, fileFormat, compressionRatio, toHumanReadableSpeed((long) inputSizeStats.getMean()), toHumanReadableSpeed((long) inputSizeStats.getMeanErrorAt(0.999)), inputSizeStats.getMeanErrorAt(0.999) * 100 / inputSizeStats.getMean(), inputSizeStats.getN());
    }
    System.out.println();
}
Also used : Options(org.openjdk.jmh.runner.options.Options) Runner(org.openjdk.jmh.runner.Runner) RunResult(org.openjdk.jmh.results.RunResult) Statistics(org.openjdk.jmh.util.Statistics) OptionsBuilder(org.openjdk.jmh.runner.options.OptionsBuilder)

Example 3 with RunResult

use of org.openjdk.jmh.results.RunResult in project h2o-3 by h2oai.

the class H2OResultFormat method writeOut.

@Override
public void writeOut(Collection<RunResult> results) {
    SortedSet<String> params = new TreeSet<String>();
    for (RunResult res : results) {
        params.addAll(res.getParams().getParamsKeys());
    }
    printHeader(params);
    for (RunResult rr : results) {
        BenchmarkParams benchParams = rr.getParams();
        Result res = rr.getPrimaryResult();
        printLine(sha, date, benchParams.getBenchmark(), benchParams, params, res);
        for (String label : rr.getSecondaryResults().keySet()) {
            Result subRes = rr.getSecondaryResults().get(label);
            printLine(sha, date, benchParams.getBenchmark() + ":" + subRes.getLabel(), benchParams, params, subRes);
        }
    }
}
Also used : TreeSet(java.util.TreeSet) RunResult(org.openjdk.jmh.results.RunResult) BenchmarkParams(org.openjdk.jmh.infra.BenchmarkParams) RunResult(org.openjdk.jmh.results.RunResult) Result(org.openjdk.jmh.results.Result)

Example 4 with RunResult

use of org.openjdk.jmh.results.RunResult in project atlasdb by palantir.

the class AtlasDbPerfCli method runCli.

private static void runCli(AtlasDbPerfCli cli, ChainedOptionsBuilder optBuilder) throws Exception {
    optBuilder.warmupIterations(1).mode(Mode.SampleTime);
    Collection<RunResult> results = new Runner(optBuilder.build()).run();
    if (cli.outputFile != null) {
        new PerformanceResults(results).writeToFile(new File(cli.outputFile));
    }
}
Also used : Runner(org.openjdk.jmh.runner.Runner) PerformanceResults(com.palantir.atlasdb.performance.PerformanceResults) RunResult(org.openjdk.jmh.results.RunResult) File(java.io.File)

Example 5 with RunResult

use of org.openjdk.jmh.results.RunResult in project qpp-conversion-tool by CMSgov.

the class ParameterizedBenchmarkTest method loadPaths.

@BeforeAll
static void loadPaths() throws RunnerException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException {
    String[] paths = FileTestHelper.getAllQrdaFiles(FileSystems.getDefault(), "-latest.xml").map(Path::toString).toArray(String[]::new);
    Options opt = new OptionsBuilder().mode(Mode.Throughput).mode(Mode.AverageTime).include(".*" + ParameterizedBenchmark.class.getSimpleName() + ".*").param("fileName", paths).forks(1).build();
    List<RunResult> results = new ArrayList<>(new Runner(opt).run());
    benchResults = results.stream().map(RunResult::getAggregatedResult).collect(Collectors.toList());
}
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) BeforeAll(org.junit.jupiter.api.BeforeAll)

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