本文整理匯總了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();
}