Search in sources :

Example 1 with ProfilersFailedException

use of org.openjdk.jmh.runner.ProfilersFailedException 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)

Aggregations

File (java.io.File)1 RunResult (org.openjdk.jmh.results.RunResult)1 NoBenchmarksException (org.openjdk.jmh.runner.NoBenchmarksException)1 ProfilersFailedException (org.openjdk.jmh.runner.ProfilersFailedException)1 Runner (org.openjdk.jmh.runner.Runner)1 RunnerException (org.openjdk.jmh.runner.RunnerException)1 CommandLineOptionException (org.openjdk.jmh.runner.options.CommandLineOptionException)1 CommandLineOptions (org.openjdk.jmh.runner.options.CommandLineOptions)1