本文整理汇总了Java中org.openjdk.jmh.runner.options.OptionsBuilder类的典型用法代码示例。如果您正苦于以下问题:Java OptionsBuilder类的具体用法?Java OptionsBuilder怎么用?Java OptionsBuilder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OptionsBuilder类属于org.openjdk.jmh.runner.options包,在下文中一共展示了OptionsBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadPaths
import org.openjdk.jmh.runner.options.OptionsBuilder; //导入依赖的package包/类
@BeforeAll
static void loadPaths() throws IOException, RunnerException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException {
String[] paths;
fileSystem = FileTestHelper.createMockFileSystem(Configuration.unix());
fileSystemField = ConversionEntry.class.getDeclaredField("fileSystem");
fileSystemField.setAccessible(true);
defaultFileSystem = (FileSystem) fileSystemField.get(null);
fileSystemField.set(null, fileSystem);
paths = FileTestHelper.getAllQrdaFiles(fileSystem, "-latest.xml").map(Path::toString).toArray(String[]::new);
Options opt = new OptionsBuilder()
.mode(Mode.Throughput)
.mode(Mode.AverageTime)
.include(".*" + ParameterizedBenchmark.class.getSimpleName() + ".*")
.param("fileName", paths)
.forks(1)
.build();
List<RunResult> results = new ArrayList<>(new Runner(opt).run());
benchResults = results.stream()
.map(RunResult::getAggregatedResult)
.collect(Collectors.toList());
}
示例2: run
import org.openjdk.jmh.runner.options.OptionsBuilder; //导入依赖的package包/类
@Test
public void run() throws Exception {
//Add more iterations, forks, etc, results should be similar or better. At least they
//were on my machine.
Options opt = new OptionsBuilder()
.include(this.getClass().getName() + ".*")
//.mode(Mode.Throughput)
.mode(Mode.AverageTime)
.timeUnit(TimeUnit.MICROSECONDS)
.warmupIterations(5)
.measurementIterations(5)
.forks(1)
.threads(10)
.shouldDoGC(true)
.jvmArgs("")
.build();
new Runner(opt).run();
}
示例3: main
import org.openjdk.jmh.runner.options.OptionsBuilder; //导入依赖的package包/类
public static void main(String[] args) throws RunnerException, CommandLineOptionException {
Package currentPackage = Package.getPackage( "org.apache.bval.bench" );
System.out.println( currentPackage.getImplementationTitle() + " - " + currentPackage.getImplementationVersion() );
Options commandLineOptions = new CommandLineOptions( args );
ChainedOptionsBuilder builder = new OptionsBuilder().parent( commandLineOptions );
if ( !commandLineOptions.getResult().hasValue() ) {
builder.result( "target/jmh-results.json" );
}
if ( !commandLineOptions.getResultFormat().hasValue() ) {
builder.resultFormat( ResultFormatType.JSON );
}
if ( commandLineOptions.getIncludes().isEmpty() ) {
DEFAULT_TEST_CLASSES.forEach( testClass -> builder.include( testClass.getName() ) );
}
Options opt = builder.build();
new Runner( opt ).run();
}
示例4: launchBenchmark
import org.openjdk.jmh.runner.options.OptionsBuilder; //导入依赖的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();
}
示例5: main
import org.openjdk.jmh.runner.options.OptionsBuilder; //导入依赖的package包/类
public static void main(String[] args) throws RunnerException {
for (int threads = 1; threads < 32; threads <<= 1) {
Options opt = new OptionsBuilder()
.forks(10)
.threads(threads)
.warmupIterations(10)
.measurementIterations(20)
.mode(Mode.AverageTime)
.timeUnit(TimeUnit.NANOSECONDS)
.include("ky.korins.atomic.benchmark")
.resultFormat(ResultFormatType.CSV)
.result("atomic_" + threads + ".csv")
.build();
new Runner(opt).run();
}
}
示例6: runMicroBenchMark
import org.openjdk.jmh.runner.options.OptionsBuilder; //导入依赖的package包/类
@Test
public void runMicroBenchMark() throws RunnerException {
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)
.build();
new Runner(opt).run();
}
示例7: main
import org.openjdk.jmh.runner.options.OptionsBuilder; //导入依赖的package包/类
public static void main(String[] args) throws RunnerException {
Options opt = new OptionsBuilder()
.include(RocketMQSyncMessage.class.getSimpleName())
.warmupIterations(60)
.measurementIterations(60)
.forks(1)
.threads(20)
.build();
new Runner(opt).run();
}
示例8: main
import org.openjdk.jmh.runner.options.OptionsBuilder; //导入依赖的package包/类
public static void main(String[] args) throws RunnerException {
Options opt = new OptionsBuilder()
.include(RocketMQAsyncMessage.class.getSimpleName())
.warmupIterations(60)
.measurementIterations(60)
.forks(1)
.threads(20)
.build();
new Runner(opt).run();
}
示例9: getDefaultRunner
import org.openjdk.jmh.runner.options.OptionsBuilder; //导入依赖的package包/类
private Runner getDefaultRunner() {
final OptionsBuilder jmhOptionsBuilder = new OptionsBuilder();
if (!this.isJmhOutput()) {
jmhOptionsBuilder.verbosity(VerboseMode.SILENT);
}
return new Runner(jmhOptionsBuilder.build());
}
示例10: main
import org.openjdk.jmh.runner.options.OptionsBuilder; //导入依赖的package包/类
public static void main(String[] args) throws RunnerException {
Options opt = new OptionsBuilder()
.include(JMHSample_13_RunToRun.class.getSimpleName())
.warmupIterations(0)
.measurementIterations(5)
.build();
new Runner(opt).run();
}
示例11: main
import org.openjdk.jmh.runner.options.OptionsBuilder; //导入依赖的package包/类
public static void main(String[] args) throws RunnerException {
Options opt = new OptionsBuilder()
.include(JMHSample_01_HelloWorld.class.getSimpleName())
.forks(1)
.build();
new Runner(opt).run();
}
示例12: main
import org.openjdk.jmh.runner.options.OptionsBuilder; //导入依赖的package包/类
public static void main(String[] args) throws RunnerException {
Options opt = new OptionsBuilder()
.include(JMHSample_11_Loops.class.getSimpleName())
.warmupIterations(5)
.measurementIterations(5)
.forks(1)
.build();
new Runner(opt).run();
}
示例13: main
import org.openjdk.jmh.runner.options.OptionsBuilder; //导入依赖的package包/类
public static void main(String[] args) throws RunnerException {
Options opt = new OptionsBuilder()
.include(JMHSample_28_BlackholeHelpers.class.getSimpleName())
.build();
new Runner(opt).run();
}
示例14: main
import org.openjdk.jmh.runner.options.OptionsBuilder; //导入依赖的package包/类
public static void main(String[] args) throws RunnerException {
Options opt = new OptionsBuilder()
.include(JMHSample_27_Params.class.getSimpleName())
// .param("arg", "41", "42") // Use this to selectively constrain/override parameters
.build();
new Runner(opt).run();
}
示例15: main
import org.openjdk.jmh.runner.options.OptionsBuilder; //导入依赖的package包/类
public static void main(String[] args) throws RunnerException {
Options opt = new OptionsBuilder()
.include(JMHSample_33_SecurityManager.class.getSimpleName())
.warmupIterations(5)
.measurementIterations(5)
.forks(1)
.build();
new Runner(opt).run();
}