当前位置: 首页>>代码示例>>Java>>正文


Java Mode.values方法代码示例

本文整理汇总了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"));
        }
    }
}
 
开发者ID:msteindorfer,项目名称:jmh,代码行数:26,代码来源:CompilerControlInlineActualTest.java

示例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"));
        }
    }
}
 
开发者ID:msteindorfer,项目名称:jmh,代码行数:26,代码来源:CompilerControlDontInlineActualTest.java

示例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"));
        }
    }
}
 
开发者ID:msteindorfer,项目名称:jmh,代码行数:26,代码来源:CompilerControlExcludeActualTest.java

示例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);
    }
}
 
开发者ID:msteindorfer,项目名称:jmh,代码行数:46,代码来源:BenchmarkGenerator.java


注:本文中的org.openjdk.jmh.annotations.Mode.values方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。