本文整理匯總了Java中org.openjdk.jmh.runner.options.Options類的典型用法代碼示例。如果您正苦於以下問題:Java Options類的具體用法?Java Options怎麽用?Java Options使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Options類屬於org.openjdk.jmh.runner.options包,在下文中一共展示了Options類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: loadPaths
import org.openjdk.jmh.runner.options.Options; //導入依賴的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.Options; //導入依賴的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.Options; //導入依賴的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.Options; //導入依賴的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.Options; //導入依賴的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.Options; //導入依賴的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.Options; //導入依賴的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.Options; //導入依賴的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: main
import org.openjdk.jmh.runner.options.Options; //導入依賴的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();
}
示例10: main
import org.openjdk.jmh.runner.options.Options; //導入依賴的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();
}
示例11: main
import org.openjdk.jmh.runner.options.Options; //導入依賴的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();
}
示例12: main
import org.openjdk.jmh.runner.options.Options; //導入依賴的package包/類
public static void main(String[] args) throws RunnerException {
Options opt = new OptionsBuilder()
.include(JMHSample_28_BlackholeHelpers.class.getSimpleName())
.build();
new Runner(opt).run();
}
示例13: main
import org.openjdk.jmh.runner.options.Options; //導入依賴的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();
}
示例14: main
import org.openjdk.jmh.runner.options.Options; //導入依賴的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();
}
示例15: main
import org.openjdk.jmh.runner.options.Options; //導入依賴的package包/類
public static void main(String[] args) throws RunnerException {
Options opt = new OptionsBuilder()
.include(JMHSample_21_ConsumeCPU.class.getSimpleName())
.warmupIterations(1)
.measurementIterations(5)
.forks(1)
.build();
new Runner(opt).run();
}