org.openjdk.jmh.profile.GCProfiler Java Examples

The following examples show how to use org.openjdk.jmh.profile.GCProfiler. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BenchmarkIT.java    From hadoop-hdfs-fsimage-exporter with Apache License 2.0 7 votes vote down vote up
@Test
public void runMicroBenchMark() throws RunnerException {
    new File("target/jmh-report/").mkdirs();
    Options opt = new OptionsBuilder()
            .include(getClass().getName())
            .warmupIterations(2)
            .measurementIterations(10)
            .mode(Mode.AverageTime)
            .timeUnit(TimeUnit.MILLISECONDS)
            .addProfiler(GCProfiler.class)
            .jvmArgs("-server", "-XX:+UseG1GC", "-Xmx256m")
            .shouldDoGC(true)
            .forks(1)
            .resultFormat(ResultFormatType.JSON)
            .result("target/jmh-reports/"+getClass().getSimpleName()+".json")
            .build();

    new Runner(opt).run();
}
 
Example #2
Source File: BenchmarkGroupByHash.java    From presto with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args)
        throws RunnerException
{
    // assure the benchmarks are valid before running
    BenchmarkData data = new BenchmarkData();
    data.setup();
    new BenchmarkGroupByHash().groupByHashPreCompute(data);
    new BenchmarkGroupByHash().addPagePreCompute(data);

    SingleChannelBenchmarkData singleChannelBenchmarkData = new SingleChannelBenchmarkData();
    singleChannelBenchmarkData.setup();
    new BenchmarkGroupByHash().bigintGroupByHash(singleChannelBenchmarkData);

    Options options = new OptionsBuilder()
            .verbosity(VerboseMode.NORMAL)
            .include(".*" + BenchmarkGroupByHash.class.getSimpleName() + ".*")
            .addProfiler(GCProfiler.class)
            .jvmArgs("-Xmx10g")
            .build();
    new Runner(options).run();
}
 
Example #3
Source File: LinkedArrayBenchmark.java    From skywalking with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws RunnerException {
    Options opt = new OptionsBuilder().include(LinkedArrayBenchmark.class.getName())
                                      .addProfiler(GCProfiler.class)
                                      .jvmArgsAppend("-Xmx512m", "-Xms512m")
                                      .forks(1)
                                      .build();
    new Runner(opt).run();
}
 
Example #4
Source File: Genesis.java    From hadoop-ozone with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws RunnerException {
  CommandLine commandLine = new CommandLine(new Genesis());
  commandLine.parse(args);
  if (commandLine.isUsageHelpRequested()) {
    commandLine.usage(System.out);
    return;
  }

  OptionsBuilder optionsBuilder = new OptionsBuilder();
  if (benchmarks != null) {
    // The OptionsBuilder#include takes a regular expression as argument.
    // Therefore it is important to keep the benchmark names unique for
    // running a benchmark. For example if there are two benchmarks -
    // BenchMarkOM and BenchMarkOMClient and we include BenchMarkOM then
    // both the benchmarks will be run.
    for (String benchmark : benchmarks) {
      optionsBuilder.include(benchmark);
    }
  }
  optionsBuilder.warmupIterations(2)
      .measurementIterations(20)
      .addProfiler(StackProfiler.class)
      .addProfiler(GCProfiler.class)
      .shouldDoGC(true)
      .forks(1)
      .threads(numThreads);

  if (seconds > 0) {
    optionsBuilder.measurementTime(seconds(seconds));
  }

  new Runner(optionsBuilder.build()).run();
}
 
Example #5
Source File: ProcfsSmapsBenchmark.java    From micrometer-jvm-extras with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws RunnerException {
    final Options options = new OptionsBuilder() //
            .include(ProcfsSmapsBenchmark.class.getSimpleName()) //
            .addProfiler(GCProfiler.class) //
            .build();

    new Runner(options).run();
}
 
Example #6
Source File: MessageBenchmark.java    From qpid-proton-j with Apache License 2.0 5 votes vote down vote up
public static void runBenchmark(Class<?> benchmarkClass) throws RunnerException
{
    final Options opt = new OptionsBuilder()
        .include(benchmarkClass.getSimpleName())
        .addProfiler(GCProfiler.class)
        .shouldDoGC(true)
        .warmupIterations(5)
        .measurementIterations(5)
        .forks(1)
        .build();
    new Runner(opt).run();
}
 
Example #7
Source File: FrameWriterBenchmark.java    From qpid-proton-j with Apache License 2.0 5 votes vote down vote up
public static void runBenchmark(Class<?> benchmarkClass) throws RunnerException
{
    final Options opt = new OptionsBuilder()
        .include(benchmarkClass.getSimpleName())
        .addProfiler(GCProfiler.class)
        .shouldDoGC(true)
        .warmupIterations(5)
        .measurementIterations(5)
        .forks(1)
        .build();
    new Runner(opt).run();
}
 
Example #8
Source File: CompositeReadableBufferEqualsBenchmark.java    From qpid-proton-j with Apache License 2.0 5 votes vote down vote up
public static void runBenchmark(Class<?> benchmarkClass) throws RunnerException {
    final Options opt = new OptionsBuilder()
            .include(benchmarkClass.getSimpleName())
            .addProfiler(GCProfiler.class)
            .shouldDoGC(true)
            .warmupIterations(5)
            .measurementIterations(5)
            .forks(1)
            .build();
    new Runner(opt).run();
}
 
Example #9
Source File: CompositeReadableBufferBenchmark.java    From qpid-proton-j with Apache License 2.0 5 votes vote down vote up
public static void runBenchmark(Class<?> benchmarkClass) throws RunnerException {
    final Options opt = new OptionsBuilder()
        .include(benchmarkClass.getSimpleName())
        .addProfiler(GCProfiler.class)
        .shouldDoGC(true)
        .warmupIterations(5)
        .measurementIterations(5)
        .forks(1)
        .build();
    new Runner(opt).run();
}
 
Example #10
Source File: BulkheadBenchmark.java    From resilience4j with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws RunnerException {
    Options options = new OptionsBuilder()
        .threads(2)
        .addProfiler(GCProfiler.class)
        .build();
    new Runner(options).run();
}
 
Example #11
Source File: JmhCacheBenchmark.java    From ignite with Apache License 2.0 5 votes vote down vote up
/**
 * Run benchmark.
 *
 * @param benchmark Benchmark to run.
 * @param threads Amount of threads.
 * @param client Client mode flag.
 * @param atomicityMode Atomicity mode.
 * @param writeSyncMode Write synchronization mode.
 * @throws Exception If failed.
 */
private static void run(String benchmark, int threads, boolean client, CacheAtomicityMode atomicityMode,
    CacheWriteSynchronizationMode writeSyncMode) throws Exception {
    String simpleClsName = JmhCacheBenchmark.class.getSimpleName();

    String output = simpleClsName + "-" + benchmark +
        "-" + threads + "-threads" +
        "-" + (client ? "client" : "data") +
        "-" + atomicityMode +
        "-" + writeSyncMode;

    JmhIdeBenchmarkRunner.create()
        .forks(1)
        .threads(threads)
        .warmupIterations(10)
        .measurementIterations(60)
        .benchmarks(simpleClsName + "." + benchmark)
        .output(output + ".jmh.log")
        .profilers(GCProfiler.class)
        .jvmArguments(
            "-Xms4g",
            "-Xmx4g",
            "-XX:+UnlockCommercialFeatures",
            "-XX:+FlightRecorder",
            "-XX:StartFlightRecording=delay=30s,dumponexit=true,settings=alloc,filename=" + output + ".jfr",
            JmhIdeBenchmarkRunner.createProperty(PROP_ATOMICITY_MODE, atomicityMode),
            JmhIdeBenchmarkRunner.createProperty(PROP_WRITE_SYNC_MODE, writeSyncMode),
            JmhIdeBenchmarkRunner.createProperty(PROP_DATA_NODES, 2),
            JmhIdeBenchmarkRunner.createProperty(PROP_CLIENT_MODE, client))
        .run();
}
 
Example #12
Source File: ProcfsStatusBenchmark.java    From micrometer-jvm-extras with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws RunnerException {
    final Options options = new OptionsBuilder() //
            .include(ProcfsStatusBenchmark.class.getSimpleName()) //
            .addProfiler(GCProfiler.class) //
            .build();

    new Runner(options).run();
}
 
Example #13
Source File: BeansBenchmark.java    From cglib with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws RunnerException
{
    Options opt = new OptionsBuilder()
            .include(BeansBenchmark.class.getSimpleName())
            .addProfiler(GCProfiler.class)
            .detectJvmArgs()
            .build();

    new Runner(opt).run();
}
 
Example #14
Source File: CodeGenerationBenchmark.java    From calcite with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws RunnerException {
  Options opt = new OptionsBuilder()
      .include(CodeGenerationBenchmark.class.getName())
      .addProfiler(GCProfiler.class)
      .detectJvmArgs()
      .build();

  new Runner(opt).run();
}
 
Example #15
Source File: PreconditionTest.java    From calcite with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws RunnerException {
  Options opt = new OptionsBuilder()
      .include(PreconditionTest.class.getSimpleName())
      .addProfiler(GCProfiler.class)
      .detectJvmArgs()
      .build();

  new Runner(opt).run();
}
 
Example #16
Source File: ParserBenchmark.java    From calcite with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws RunnerException {
  Options opt = new OptionsBuilder()
      .include(ParserBenchmark.class.getSimpleName())
      .addProfiler(GCProfiler.class)
      .addProfiler(FlightRecorderProfiler.class)
      .detectJvmArgs()
      .build();

  new Runner(opt).run();
}
 
Example #17
Source File: TDigestBench.java    From t-digest with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws RunnerException {
    Options opt = new OptionsBuilder()
            .include(".*" + TDigestBench.class.getSimpleName() + ".*")
            .resultFormat(ResultFormatType.CSV)
            .result("overall-results.csv")
            .addProfiler(GCProfiler.class)
            .addProfiler(StackProfiler.class)
            .build();

    new Runner(opt).run();
}
 
Example #18
Source File: Benchmark.java    From t-digest with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws RunnerException {
    Options opt = new OptionsBuilder()
            .include(".*" + Benchmark.class.getSimpleName() + ".*")
            .resultFormat(ResultFormatType.CSV)
            .result("results.csv")
            .addProfiler(GCProfiler.class)
            .addProfiler(StackProfiler.class)
            .build();

    new Runner(opt).run();
}
 
Example #19
Source File: FloatHistogramBench.java    From t-digest with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws RunnerException {
    Options opt = new OptionsBuilder()
            .include(".*" + FloatHistogramBench.class.getSimpleName() + ".*")
            .resultFormat(ResultFormatType.CSV)
            .result("overall-results.csv")
            .addProfiler(StackProfiler.class)
            .addProfiler(GCProfiler.class)
            .build();

    new Runner(opt).run();
}
 
Example #20
Source File: PreExecutionBenchmark.java    From crate with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws RunnerException {
    Options opt = new OptionsBuilder()
        .include(PreExecutionBenchmark.class.getSimpleName())
        .addProfiler(GCProfiler.class)
        .build();
    new Runner(opt).run();
}
 
Example #21
Source File: BenchmarkRBACModelSingle.java    From jcasbin with Apache License 2.0 5 votes vote down vote up
public static void main(String args[]) throws RunnerException {
    Options opt = new OptionsBuilder()
        .include(BenchmarkRBACModelSingle.class.getName())
        .exclude("Pref")
        .warmupIterations(3)
        .measurementIterations(3)
        .addProfiler(GCProfiler.class)
        .forks(1)
        .build();
    new Runner(opt).run();
}
 
Example #22
Source File: BenchmarkUnnestOperator.java    From presto with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args)
        throws RunnerException
{
    Options options = new OptionsBuilder()
            .verbosity(VerboseMode.NORMAL)
            .include(".*" + BenchmarkUnnestOperator.class.getSimpleName() + ".*")
            .addProfiler(GCProfiler.class)
            .build();

    new Runner(options).run();
}
 
Example #23
Source File: BenchmarkGroupedTypedHistogram.java    From presto with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args)
        throws RunnerException
{
    Options options = new OptionsBuilder()
            .verbosity(VerboseMode.NORMAL)
            .include(".*" + BenchmarkGroupedTypedHistogram.class.getSimpleName() + ".*")
            .addProfiler(GCProfiler.class)
            .build();

    new Runner(options).run();
}
 
Example #24
Source File: BenchmarkReferenceCountMap.java    From presto with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args)
        throws RunnerException
{
    Options options = new OptionsBuilder()
            .verbosity(VerboseMode.NORMAL)
            .warmupMode(WarmupMode.BULK)
            .include(".*" + BenchmarkReferenceCountMap.class.getSimpleName() + ".*")
            .addProfiler(GCProfiler.class)
            .jvmArgs("-XX:+UseG1GC")
            .build();

    new Runner(options).run();
}
 
Example #25
Source File: AbstractBenchmark.java    From apm-agent-java with Apache License 2.0 5 votes vote down vote up
/**
 * Convenience benchmark run method
 * <p>
 * For more accurate results, execute {@code mvn clean package} and run the benchmark via
 * {@code java -jar apm-agent-benchmarks/target/benchmarks.jar -prof gc}
 */
public static void run(Class<? extends AbstractBenchmark> benchmark) throws RunnerException {
    new Runner(new OptionsBuilder()
        .include(benchmark.getSimpleName())
        .measurementTime(TimeValue.seconds(1))
        .warmupTime(TimeValue.seconds(1))
        .addProfiler(GCProfiler.class)
        .addProfiler(CpuProfiler.class)
        .addProfiler(ReporterProfiler.class)
        .build())
        .run();
}
 
Example #26
Source File: FastAvroSerdesBenchmark.java    From avro-util with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public static void main(String[] args) throws RunnerException {
  org.openjdk.jmh.runner.options.Options opt = new OptionsBuilder()
      .include(FastAvroSerdesBenchmark.class.getSimpleName())
      .addProfiler(GCProfiler.class)
      .build();
  new Runner(opt).run();
}
 
Example #27
Source File: BenchmarkGSetFiltering.java    From NNAnalytics with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws RunnerException {
  Options opt =
      new OptionsBuilder()
          .include(".*" + BenchmarkGSetFiltering.class.getSimpleName() + ".*")
          .warmupIterations(5)
          .measurementIterations(5)
          .addProfiler(MemoryProfiler.class)
          .addProfiler(GCProfiler.class)
          .forks(1)
          .build();
  new Runner(opt).run();
}
 
Example #28
Source File: BenchmarkBasicModel.java    From jcasbin with Apache License 2.0 5 votes vote down vote up
public static void main(String args[]) throws RunnerException {
    Options opt = new OptionsBuilder()
        .include(BenchmarkBasicModel.class.getName())
        .exclude("Pref")
        .warmupIterations(3)
        .measurementIterations(3)
        .addProfiler(GCProfiler.class)
        .forks(1)
        .build();
    new Runner(opt).run();
}
 
Example #29
Source File: BenchmarkRBACModelMedium.java    From jcasbin with Apache License 2.0 5 votes vote down vote up
public static void main(String args[]) throws RunnerException {
    Options opt = new OptionsBuilder()
        .include(BenchmarkRBACModelMedium.class.getName())
        .exclude("Pref")
        .warmupIterations(3)
        .measurementIterations(1)
        .addProfiler(GCProfiler.class)
        .forks(1)
        .build();
    new Runner(opt).run();
}
 
Example #30
Source File: BenchmarkRBACModelWithResourceRoles.java    From jcasbin with Apache License 2.0 5 votes vote down vote up
public static void main(String args[]) throws RunnerException {
    Options opt = new OptionsBuilder()
        .include(BenchmarkRBACModelWithResourceRoles.class.getName())
        .exclude("Pref")
        .warmupIterations(3)
        .measurementIterations(3)
        .addProfiler(GCProfiler.class)
        .forks(1)
        .build();
    new Runner(opt).run();
}