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();
}
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);
}
}
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;
}
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;
}
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;
}
Aggregations