コード例 #1
0
  @Test
  public void launchBenchmark() throws Exception {
    Options opt =
        new OptionsBuilder()
            // Specify which benchmarks to run.
            // You can be more specific if you'd like to run only one
            // benchmark per test.
            .include(this.getClass().getName() + ".*")
            // Set the following options as needed
            .mode(Mode.AverageTime)
            .timeUnit(TimeUnit.NANOSECONDS)
            .warmupTime(TimeValue.seconds(1))
            .warmupIterations(3)
            .measurementTime(TimeValue.seconds(1))
            .measurementIterations(3)
            .threads(2)
            .forks(1)
            .shouldFailOnError(true)
            .shouldDoGC(true)
            // .jvmArgs("-XX:+UnlockDiagnosticVMOptions",
            // "-XX:+PrintInlining")
            // .addProfiler(WinPerfAsmProfiler.class)
            .build();

    new Runner(opt).run();
  }
コード例 #2
0
  public static void main(String[] args) throws RunnerException {
    System.out.println(JmhMapBenchmarks.class.getSimpleName());
    Options opt =
        new OptionsBuilder()
            .include(".*" + JmhMapBenchmarks.class.getSimpleName() + ".(timeInsert)")
            .timeUnit(TimeUnit.NANOSECONDS)
            .forks(0)
            // .warmupMode(WarmupMode.INDI)
            .warmupIterations(0)
            .warmupTime(TimeValue.seconds(1))
            .mode(Mode.AverageTime)
            .measurementIterations(5)
            .param("dataType", "MAP")
            .param("run", "0")
            //				.param("run", "1")
            //				.param("run", "2")
            //				.param("run", "3")
            // .addProfiler(CountingIntegerProfiler.class)
            // .param("producer", "SLEEPING_INTEGER")
            .param("producer", "COUNTING_INTEGER")
            .param("sampleDataSelection", "MATCH")
            .param("size", "1024") // 1048576
            // .param("valueFactoryFactory", "VF_PDB_PERSISTENT_SPECIALIZED")
            .param("valueFactoryFactory", "VF_PDB_PERSISTENT_CURRENT")
            // .param("valueFactoryFactory", "VF_SCALA")
            // .param("valueFactoryFactory", "VF_CLOJURE")
            .resultFormat(ResultFormatType.CSV)
            .result("latest-results-main.csv")
            .build();

    new Runner(opt).run();
  }
コード例 #3
0
  public static void main(String[] args) throws RunnerException {
    Options opt =
        new OptionsBuilder()
            .include(".*" + Class.class.getSimpleName() + ".*") // CLASS
            .timeUnit(TimeUnit.NANOSECONDS)
            .mode(Mode.AverageTime)
            .warmupIterations(20)
            .warmupTime(TimeValue.milliseconds(1)) // ALLOWED TIME
            .measurementIterations(5)
            .measurementTime(TimeValue.milliseconds(1)) // ALLOWED TIME
            .forks(1) // FORKS
            .verbosity(VerboseMode.SILENT) // GRAPH
            .threads(1) // THREADS
            .build();

    Benchmarks.chart(Benchmarks.parse(new Runner(opt).run()), "Reflection+methods"); // TITLE
  }
コード例 #4
0
  public static void main(String[] args) throws RunnerException, IOException {
    long time = 2;
    Options opt =
        new OptionsBuilder()
            .include(CalcBenchmark.class.getSimpleName())
            .warmupIterations(6)
            .forks(1)
            .measurementTime(TimeValue.seconds(time))
            .timeUnit(TimeUnit.NANOSECONDS)
            .build();

    new Runner(opt).run();
  }