Search in sources :

Example 26 with OptionsBuilder

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

the class ClientBenchmark method main.

public static void main(final String[] args) throws Exception {
    final Options opt = new OptionsBuilder().include(ClientBenchmark.class.getSimpleName()).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 27 with OptionsBuilder

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

the class JmhRunner method run.

private static Array<RunResult> run(int warmupIterations, int measurementIterations, int millis, ForkJvm forkJvm, VerboseMode verboseMode, Assertions assertions, PrintInlining printInlining, Array<String> classNames, Array<String> includeNames) {
    try {
        final ChainedOptionsBuilder builder = new OptionsBuilder().shouldDoGC(true).verbosity(verboseMode).shouldFailOnError(true).mode(Mode.Throughput).timeUnit(TimeUnit.SECONDS).warmupTime(TimeValue.milliseconds(millis)).warmupIterations(warmupIterations).measurementTime(TimeValue.milliseconds(millis)).measurementIterations(measurementIterations).forks(forkJvm.forkCount).jvmArgsAppend("-XX:+UseG1GC", "-Xss100m", "-Xms4g", "-Xmx4g", "-XX:MaxGCPauseMillis=1000", "-XX:+UnlockExperimentalVMOptions", "-XX:G1NewSizePercent=100", "-XX:G1MaxNewSizePercent=100", assertions.vmArg);
        final String includePattern = includeNames.mkString("\\..*?\\b(", "|", ")_");
        classNames.forEach(name -> builder.include(name + includePattern));
        if (printInlining == PrintInlining.ENABLE) {
            builder.jvmArgsAppend("-XX:+UnlockDiagnosticVMOptions", "-XX:+PrintInlining");
        /* might help in deciding when the JVM is properly warmed up - or where to optimize the code */
        }
        return Array.ofAll(new Runner(builder.build()).run());
    } catch (RunnerException e) {
        throw new RuntimeException(e);
    }
}
Also used : Runner(org.openjdk.jmh.runner.Runner) ChainedOptionsBuilder(org.openjdk.jmh.runner.options.ChainedOptionsBuilder) RunnerException(org.openjdk.jmh.runner.RunnerException) OptionsBuilder(org.openjdk.jmh.runner.options.OptionsBuilder) ChainedOptionsBuilder(org.openjdk.jmh.runner.options.ChainedOptionsBuilder)

Example 28 with OptionsBuilder

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

the class LRUCacheBenchmark method main.

public static void main(String[] args) throws RunnerException {
    Options opt = new OptionsBuilder().include(LRUCacheBenchmark.class.getSimpleName()).forks(2).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 29 with OptionsBuilder

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

the class ConvertInputStreamToStringBenchmark method main.

public static void main(String[] args) throws Exception {
    ConvertInputStreamToStringBenchmark test = new ConvertInputStreamToStringBenchmark();
    System.out.println();
    System.out.println("1. apacheToInputStream : " + test.test1_apacheToInputStream().length());
    System.out.println("2. guavaCharStreams : " + test.test2_guavaCharStreams().length());
    System.out.println("3. jdkScanner : " + test.test3_jdkScanner().length());
    System.out.println("4. jdkJava8 : " + test.test4_jdkJava8().length());
    System.out.println("5. jdkJava8parallel : " + test.test5_jdkJava8parallel().length());
    System.out.println("6. inputStreamReaderAndStringBuilder : " + test.test6_inputStreamReaderAndStringBuilder().length());
    System.out.println("7. apacheStringWriterAndIOUtilsCopy : " + test.test7_apacheStringWriterAndIOUtilsCopy().length());
    System.out.println("8. readByteArrayOutputStream : " + test.test8_readByteArrayOutputStream().length());
    System.out.println("9. bufferedReaderReadLine : " + test.test9_bufferedReaderReadLine().length());
    System.out.println("10. bufferedInputStreamAndByteArrayOutputStream : " + test.test10_bufferedInputStreamAndByteArrayOutputStream().length());
    System.out.println("11. inputStreamReadAndStringBuilder : " + test.test11_inputStreamReadAndStringBuilder().length());
    System.out.println("12. test12_bufferedReaderReadLine2 : " + test.test12_bufferedReaderReadLine2().length());
    System.out.println();
    Options opt = new OptionsBuilder().include(ConvertInputStreamToStringBenchmark.class.getSimpleName()).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 30 with OptionsBuilder

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

the class ConvertInputStreamToStringBigBenchmark method main.

public static void main(String[] args) throws Exception {
    ConvertInputStreamToStringBigBenchmark test = new ConvertInputStreamToStringBigBenchmark();
    System.out.println();
    System.out.println("1. apacheToInputStream : " + test.apacheToInputStream().length());
    System.out.println("2. guavaCharStreams : " + test.guavaCharStreams().length());
    System.out.println("3. jdkScanner : " + test.jdkScanner().length());
    System.out.println("4. jdkJava8 : " + test.jdkJava8().length());
    System.out.println("5. jdkJava8parallel : " + test.jdkJava8parallel().length());
    System.out.println("6. inputStreamReaderAndStringBuilder : " + test.inputStreamReaderAndStringBuilder().length());
    System.out.println("7. apacheStringWriterAndIOUtilsCopy : " + test.apacheStringWriterAndIOUtilsCopy().length());
    System.out.println("8. readByteArrayOutputStream : " + test.readByteArrayOutputStream().length());
    System.out.println("9. bufferedReaderReadLine : " + test.bufferedReaderReadLine().length());
    System.out.println("10. bufferedInputStreamAndByteArrayOutputStream : " + test.bufferedInputStreamAndByteArrayOutputStream().length());
    System.out.println("11. inputStreamReadAndStringBuilder : " + test.inputStreamReadAndStringBuilder().length());
    System.out.println("12. test12_bufferedReaderReadLine2 : " + test.test12_bufferedReaderReadLine2().length());
    System.out.println();
    Options opt = new OptionsBuilder().include(ConvertInputStreamToStringBigBenchmark.class.getSimpleName()).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)

Aggregations

OptionsBuilder (org.openjdk.jmh.runner.options.OptionsBuilder)84 Runner (org.openjdk.jmh.runner.Runner)79 Options (org.openjdk.jmh.runner.options.Options)76 StackProfiler (org.openjdk.jmh.profile.StackProfiler)7 ChainedOptionsBuilder (org.openjdk.jmh.runner.options.ChainedOptionsBuilder)7 File (java.io.File)3 RunResult (org.openjdk.jmh.results.RunResult)3 ArrayList (java.util.ArrayList)2 GCProfiler (org.openjdk.jmh.profile.GCProfiler)2 LinuxPerfAsmProfiler (org.openjdk.jmh.profile.LinuxPerfAsmProfiler)2 LinuxPerfProfiler (org.openjdk.jmh.profile.LinuxPerfProfiler)2 GraknSystemProperty (ai.grakn.GraknSystemProperty)1 CacheAtomicityMode (org.apache.ignite.cache.CacheAtomicityMode)1 CacheWriteSynchronizationMode (org.apache.ignite.cache.CacheWriteSynchronizationMode)1 JmhIdeBenchmarkRunner (org.apache.ignite.internal.benchmarks.jmh.runner.JmhIdeBenchmarkRunner)1 Mode (org.openjdk.jmh.annotations.Mode)1 BenchmarkParams (org.openjdk.jmh.infra.BenchmarkParams)1 Result (org.openjdk.jmh.results.Result)1 RunnerException (org.openjdk.jmh.runner.RunnerException)1 Statistics (org.openjdk.jmh.util.Statistics)1