Search in sources :

Example 1 with ChainedOptionsBuilder

use of org.openjdk.jmh.runner.options.ChainedOptionsBuilder in project pinot by linkedin.

the class BenchmarkQueryEngine method main.

public static void main(String[] args) throws Exception {
    ChainedOptionsBuilder opt = new OptionsBuilder().include(BenchmarkQueryEngine.class.getSimpleName()).warmupTime(TimeValue.seconds(30)).warmupIterations(4).measurementTime(TimeValue.seconds(30)).measurementIterations(20);
    if (ENABLE_PROFILING) {
        opt = opt.addProfiler(StackProfiler.class, "excludePackages=true;excludePackageNames=sun.,java.net.,io.netty.,org.apache.zookeeper.,org.eclipse.jetty.;lines=5;period=1;top=20");
    }
    new Runner(opt.build()).run();
}
Also used : Runner(org.openjdk.jmh.runner.Runner) ChainedOptionsBuilder(org.openjdk.jmh.runner.options.ChainedOptionsBuilder) ChainedOptionsBuilder(org.openjdk.jmh.runner.options.ChainedOptionsBuilder) OptionsBuilder(org.openjdk.jmh.runner.options.OptionsBuilder) StackProfiler(org.openjdk.jmh.profile.StackProfiler)

Example 2 with ChainedOptionsBuilder

use of org.openjdk.jmh.runner.options.ChainedOptionsBuilder 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 3 with ChainedOptionsBuilder

use of org.openjdk.jmh.runner.options.ChainedOptionsBuilder in project grakn by graknlabs.

the class BenchmarkTest method newOptionsBuilder.

private ChainedOptionsBuilder newOptionsBuilder() throws Exception {
    String className = getClass().getSimpleName();
    ChainedOptionsBuilder runnerOptions = new OptionsBuilder().include(".*" + className + ".*").detectJvmArgs();
    // We have to pass system properties into the child JVM
    // TODO: This should probably not be necessary
    List<String> jvmArgs = new ArrayList<>();
    for (GraknSystemProperty property : GraknSystemProperty.values()) {
        String value = property.value();
        if (value != null) {
            jvmArgs.add("-D" + property.key() + "=" + value);
        }
    }
    runnerOptions.jvmArgsAppend(jvmArgs.toArray(new String[jvmArgs.size()]));
    if (getWarmupIterations() > 0) {
        runnerOptions.warmupIterations(getWarmupIterations());
    }
    if (getMeasureIterations() > 0) {
        runnerOptions.measurementIterations(getMeasureIterations());
    }
    if (getReportDir() != null) {
        String filePath = getReportDir() + className + ".json";
        File file = new File(filePath);
        if (file.exists()) {
            file.delete();
        } else {
            file.getParentFile().mkdirs();
            file.createNewFile();
        }
        runnerOptions.resultFormat(ResultFormatType.JSON);
        runnerOptions.result(filePath);
    }
    return runnerOptions;
}
Also used : ChainedOptionsBuilder(org.openjdk.jmh.runner.options.ChainedOptionsBuilder) GraknSystemProperty(ai.grakn.GraknSystemProperty) ArrayList(java.util.ArrayList) File(java.io.File) OptionsBuilder(org.openjdk.jmh.runner.options.OptionsBuilder) ChainedOptionsBuilder(org.openjdk.jmh.runner.options.ChainedOptionsBuilder)

Example 4 with ChainedOptionsBuilder

use of org.openjdk.jmh.runner.options.ChainedOptionsBuilder in project mule by mulesoft.

the class AbstractBenchmarkAssertionTestCase method createCommonOptionsBuilder.

private ChainedOptionsBuilder createCommonOptionsBuilder(Class clazz, String testName, Map<String, String[]> params, TimeUnit timeUnit, boolean profileGC) {
    ChainedOptionsBuilder optionsBuilder = new OptionsBuilder();
    optionsBuilder = optionsBuilder.include(clazz.getSimpleName() + "." + testName + "$").timeUnit(timeUnit);
    if (profileGC) {
        optionsBuilder = optionsBuilder.addProfiler(GCProfiler.class);
    }
    for (Entry<String, String[]> entries : params.entrySet()) {
        optionsBuilder = optionsBuilder.param(entries.getKey(), entries.getValue());
    }
    return optionsBuilder;
}
Also used : GCProfiler(org.openjdk.jmh.profile.GCProfiler) ChainedOptionsBuilder(org.openjdk.jmh.runner.options.ChainedOptionsBuilder) OptionsBuilder(org.openjdk.jmh.runner.options.OptionsBuilder) ChainedOptionsBuilder(org.openjdk.jmh.runner.options.ChainedOptionsBuilder)

Example 5 with ChainedOptionsBuilder

use of org.openjdk.jmh.runner.options.ChainedOptionsBuilder in project netty by netty.

the class AbstractMicrobenchmarkBase method newOptionsBuilder.

protected ChainedOptionsBuilder newOptionsBuilder() throws Exception {
    String className = getClass().getSimpleName();
    ChainedOptionsBuilder runnerOptions = new OptionsBuilder().include(".*" + className + ".*").jvmArgs(jvmArgs());
    if (getWarmupIterations() > 0) {
        runnerOptions.warmupIterations(getWarmupIterations());
    }
    if (getMeasureIterations() > 0) {
        runnerOptions.measurementIterations(getMeasureIterations());
    }
    if (getReportDir() != null) {
        String filePath = getReportDir() + className + ".json";
        File file = new File(filePath);
        if (file.exists()) {
            file.delete();
        } else {
            file.getParentFile().mkdirs();
            file.createNewFile();
        }
        runnerOptions.resultFormat(ResultFormatType.JSON);
        runnerOptions.result(filePath);
    }
    return runnerOptions;
}
Also used : ChainedOptionsBuilder(org.openjdk.jmh.runner.options.ChainedOptionsBuilder) File(java.io.File) OptionsBuilder(org.openjdk.jmh.runner.options.OptionsBuilder) ChainedOptionsBuilder(org.openjdk.jmh.runner.options.ChainedOptionsBuilder)

Aggregations

ChainedOptionsBuilder (org.openjdk.jmh.runner.options.ChainedOptionsBuilder)12 OptionsBuilder (org.openjdk.jmh.runner.options.OptionsBuilder)11 Runner (org.openjdk.jmh.runner.Runner)7 File (java.io.File)3 RunnerException (org.openjdk.jmh.runner.RunnerException)3 ArrayList (java.util.ArrayList)2 Options (org.openjdk.jmh.runner.options.Options)2 GraknSystemProperty (ai.grakn.GraknSystemProperty)1 BenchmarkParams (org.openjdk.jmh.infra.BenchmarkParams)1 GCProfiler (org.openjdk.jmh.profile.GCProfiler)1 StackProfiler (org.openjdk.jmh.profile.StackProfiler)1 RunResult (org.openjdk.jmh.results.RunResult)1