當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。