本文整理汇总了Java中org.openjdk.jmh.runner.Runner.run方法的典型用法代码示例。如果您正苦于以下问题:Java Runner.run方法的具体用法?Java Runner.run怎么用?Java Runner.run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openjdk.jmh.runner.Runner
的用法示例。
在下文中一共展示了Runner.run方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: launchBenchmark
import org.openjdk.jmh.runner.Runner; //导入方法依赖的package包/类
@Test
public void launchBenchmark() throws Exception {
Options opt = new OptionsBuilder()
.include(this.getClass().getName() + ".*")
.warmupTime(TimeValue.seconds(5))
.warmupIterations(2)
.measurementTime(TimeValue.seconds(1))
.measurementIterations(10)
.threads(4)
.forks(2)
.shouldFailOnError(true)
.shouldDoGC(true)
.build();
Runner runner = new Runner(opt);
runner.run();
}
示例2: main
import org.openjdk.jmh.runner.Runner; //导入方法依赖的package包/类
public static void main(String[] args) throws RunnerException {
ParsedArgs parsed = CliFactory.parseArguments(ParsedArgs.class, args);
ChainedOptionsBuilder builder = new OptionsBuilder()
.include(parsed.include())
.mode(parsed.mode())
.measurementTime(TimeValue.seconds(parsed.measurementTime()))
.warmupIterations(10)
.measurementIterations(10)
.forks(1)
.jvmArgsPrepend("-server", "-XX:-TieredCompilation")
.shouldFailOnError(true)
.verbosity(VerboseMode.EXTRA)
.resultFormat(ResultFormatType.CSV);
if (parsed.printAssembly()) {
builder = builder.jvmArgsAppend("-XX:+UnlockDiagnosticVMOptions",
"-XX:CompileCommand=print" + (null == parsed.methodName()
? "" : ",*" + parsed.methodName()),
"-XX:PrintAssemblyOptions=hsdis-print-bytes",
"-XX:CompileCommand=print");
}
if (parsed.doPerfasm()) {
String os = System.getProperty("os.name");
if (os.toLowerCase().contains("windows")) {
builder = builder.addProfiler(WinPerfAsmProfiler.class);
}
if (os.toLowerCase().contains("linux")) {
builder = builder.addProfiler(LinuxPerfAsmProfiler.class);
}
}
if (parsed.printCompilation()) {
builder = builder.jvmArgsAppend("-XX:+PrintCompilation",
"-XX:+UnlockDiagnosticVMOptions",
"-XX:+PrintInlining");
}
if (null != parsed.output()) {
builder = builder.output(parsed.output());
}
Runner runner = new Runner(builder.build());
runner.list();
runner.run();
}