public static void main(String[] args) throws RunnerException, CommandLineOptionException { Options commandLineOptions = new CommandLineOptions( args ); ChainedOptionsBuilder builder = new OptionsBuilder().parent( commandLineOptions ); if ( !commandLineOptions.getResult().hasValue() ) { builder.result( "target/jmh-results.json" ); } if ( !commandLineOptions.getResultFormat().hasValue() ) { builder.resultFormat( ResultFormatType.JSON ); } if ( commandLineOptions.getIncludes().isEmpty() ) { DEFAULT_TEST_CLASSES.forEach( testClass -> builder.include( testClass.getName() ) ); } Options opt = builder.build(); new Runner( opt ).run(); }
public OutputFormat createOutputFormat(Options options) { // sadly required here as the check cannot be made before calling this method in // constructor if (options == null) { throw new IllegalArgumentException("Options not allowed to be null."); } PrintStream out; if (options.getOutput().hasValue()) { try { out = new PrintStream(options.getOutput().get()); } catch (FileNotFoundException ex) { throw new IllegalStateException(ex); } } else { // Protect the System.out from accidental closing try { out = new UnCloseablePrintStream(System.out, Utils.guessConsoleEncoding()); } catch (UnsupportedEncodingException ex) { throw new IllegalStateException(ex); } } return OutputFormatFactory.createFormatInstance(out, options.verbosity().orElse(Defaults.VERBOSITY)); } }
System.err.println("No matching benchmarks. Miss-spelled regexp?"); if (opts.verbosity().orElse(Defaults.VERBOSITY) != VerboseMode.EXTRA) { System.err.println("Use " + VerboseMode.EXTRA + " verbose mode to debug the pattern matching."); } else {
private static OutputFormat createOutputFormat(Options options) { // sadly required here as the check cannot be made before calling this method in // constructor if (options == null) { throw new IllegalArgumentException("Options not allowed to be null."); } PrintStream out; if (options.getOutput().hasValue()) { try { out = new PrintStream(options.getOutput().get()); } catch (FileNotFoundException ex) { throw new IllegalStateException(ex); } } else { // Protect the System.out from accidental closing try { out = new UnCloseablePrintStream(System.out, Utils.guessConsoleEncoding()); } catch (UnsupportedEncodingException ex) { throw new IllegalStateException(ex); } } return OutputFormatFactory.createFormatInstance(out, options.verbosity().orElse(Defaults.VERBOSITY)); }