本文整理汇总了Java中org.openjdk.jmh.annotations.Mode.values方法的典型用法代码示例。如果您正苦于以下问题:Java Mode.values方法的具体用法?Java Mode.values怎么用?Java Mode.values使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openjdk.jmh.annotations.Mode
的用法示例。
在下文中一共展示了Mode.values方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testGMB
import org.openjdk.jmh.annotations.Mode; //导入方法依赖的package包/类
@Test
public void testGMB() throws RunnerException {
for (Mode mode : Mode.values()) {
if (mode == Mode.All) continue;
Options opts = new OptionsBuilder()
.include(Fixtures.getTestMask(this.getClass()))
.mode(mode)
.shouldFailOnError(true)
.addProfiler(LogConsumeProfiler.class)
.measurementIterations(mode == Mode.SingleShotTime ? 100000 : 1)
.measurementTime(TimeValue.seconds(5))
.warmupIterations(0)
.forks(1)
.build();
RunResult runResult = new Runner(opts).runSingle();
if (CompilerControlUtils.check(runResult, "@", "callee")) { // Poor man's check -XX:+PrintInlining works
Assert.assertTrue("Failed with " + mode,
CompilerControlUtils.check(runResult, this.getClass().getName() + "::compilerControlSpecimen", "force inline by"));
Assert.assertTrue("Failed with " + mode,
CompilerControlUtils.check(runResult, this.getClass().getName() + "::strawMethod", "force inline by"));
}
}
}
示例2: testGMB
import org.openjdk.jmh.annotations.Mode; //导入方法依赖的package包/类
@Test
public void testGMB() throws RunnerException {
for (Mode mode : Mode.values()) {
if (mode == Mode.All) continue;
Options opts = new OptionsBuilder()
.include(Fixtures.getTestMask(this.getClass()))
.mode(mode)
.shouldFailOnError(true)
.addProfiler(LogConsumeProfiler.class)
.measurementIterations(mode == Mode.SingleShotTime ? 100000 : 1)
.measurementTime(TimeValue.seconds(5))
.warmupIterations(0)
.forks(1)
.build();
RunResult runResult = new Runner(opts).runSingle();
if (CompilerControlUtils.check(runResult, "@", "callee")) { // Poor man's check -XX:+PrintInlining works
Assert.assertTrue("Failed with " + mode,
CompilerControlUtils.check(runResult, this.getClass().getName() + "::compilerControlSpecimen", "disallowed by"));
Assert.assertTrue("Failed with " + mode,
CompilerControlUtils.check(runResult, this.getClass().getName() + "::strawMethod", "disallowed by"));
}
}
}
示例3: testGMB
import org.openjdk.jmh.annotations.Mode; //导入方法依赖的package包/类
@Test
public void testGMB() throws RunnerException {
for (Mode mode : Mode.values()) {
if (mode == Mode.All) continue;
Options opts = new OptionsBuilder()
.include(Fixtures.getTestMask(this.getClass()))
.mode(mode)
.shouldFailOnError(true)
.addProfiler(LogConsumeProfiler.class)
.measurementIterations(mode == Mode.SingleShotTime ? 100000 : 1)
.measurementTime(TimeValue.seconds(5))
.warmupIterations(0)
.forks(1)
.build();
RunResult runResult = new Runner(opts).runSingle();
if (CompilerControlUtils.check(runResult, "@", "callee")) { // Poor man's check -XX:+PrintInlining works
Assert.assertTrue("Failed with " + mode,
CompilerControlUtils.check(runResult, this.getClass().getName() + "::compilerControlSpecimen", "excluded by"));
Assert.assertTrue("Failed with " + mode,
CompilerControlUtils.check(runResult, this.getClass().getName() + "::strawMethod", "excluded by"));
}
}
}
示例4: generate
import org.openjdk.jmh.annotations.Mode; //导入方法依赖的package包/类
/**
* Execute the next phase of benchmark generation.
* Multiple calls to this method are acceptable, even with the difference sources
*
* @param source generator source to get the metadata from
* @param destination generator destination to write the results to
*/
public void generate(GeneratorSource source, GeneratorDestination destination) {
try {
// Build a Set of classes with a list of annotated methods
Multimap<ClassInfo, MethodInfo> clazzes = buildAnnotatedSet(source);
// Generate code for all found Classes and Methods
for (ClassInfo clazz : clazzes.keys()) {
if (!processedBenchmarks.add(clazz.getQualifiedName())) continue;
try {
validateBenchmark(clazz, clazzes.get(clazz));
Collection<BenchmarkInfo> infos = makeBenchmarkInfo(clazz, clazzes.get(clazz));
for (BenchmarkInfo info : infos) {
generateClass(source, destination, clazz, info);
}
benchmarkInfos.addAll(infos);
} catch (GenerationException ge) {
destination.printError(ge.getMessage(), ge.getElement());
}
}
/*
* JMH stubs should not be inlined to start the inlining budget from the hottest loop.
* We would like to accurately track the things we do not want to inline, but
* unfortunately the Hotspot's CompilerOracle is not scaling well with the number of compiler
* commands. Therefore, in order to cut down the number of compiler commands, we opt to
* blankly forbid the inlining all methods that look like JMH stubs.
*
* See: https://bugs.openjdk.java.net/browse/JDK-8057169
*/
for (Mode mode : Mode.values()) {
compilerControl.alwaysDontInline("*", "*_" + mode.shortLabel() + JMH_STUB_SUFFIX);
}
compilerControl.process(source, destination);
} catch (Throwable t) {
destination.printError("Annotation generator had thrown the exception.", t);
}
}