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


Java RunResult类代码示例

本文整理汇总了Java中org.openjdk.jmh.results.RunResult的典型用法代码示例。如果您正苦于以下问题:Java RunResult类的具体用法?Java RunResult怎么用?Java RunResult使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


RunResult类属于org.openjdk.jmh.results包,在下文中一共展示了RunResult类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: loadPaths

import org.openjdk.jmh.results.RunResult; //导入依赖的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());
}
 
开发者ID:CMSgov,项目名称:qpp-conversion-tool,代码行数:24,代码来源:ParameterizedBenchmarkTest.java

示例2: main

import org.openjdk.jmh.results.RunResult; //导入依赖的package包/类
public static void main(String[] args) throws RunnerException {
    if(args.length != 1 || args[0] == null || args[0].isEmpty()) {
        System.exit(1);
    }
    String testName = args[0];

    Options opt = addTestToOptionsBuilder(new OptionsBuilder(), testName)
            .forks(NO_FORKS_RUN_ON_THE_SAME_JVM)
            // We need to avoid warmup iterations as they however counts towards total Postgres time
            .warmupIterations(0)
            .measurementIterations(ITERATIONS)
            .timeUnit(TimeUnit.MILLISECONDS)
            .mode(Mode.SingleShotTime)
            .verbosity(VerboseMode.SILENT)
            .build();

    Collection<RunResult> runResults = new Runner(opt).run();

    runResults.stream().forEach(runResult ->
        System.out.printf(
                "Java:\t%s\t%.2f\n",
                runResult.getParams().getBenchmark(),
                runResult.getPrimaryResult().getScore()
        )
    );
}
 
开发者ID:8kdata,项目名称:javapgperf,代码行数:27,代码来源:Main.java

示例3: main

import org.openjdk.jmh.results.RunResult; //导入依赖的package包/类
public static void main(String[] args) throws RunnerException, IOException {
	final String include;
	if (args.length == 0) {
		include = askRunAll();
	} else {
		include = args[0];
	}
	final Options opt = new OptionsBuilder()//
		.include(include)//
		.mode(Mode.Throughput)//
		.measurementIterations(3)//
		.measurementBatchSize(1)//
		.measurementTime(TimeValue.milliseconds(1000))//
		.forks(1)//
		.timeUnit(TimeUnit.MICROSECONDS)//
		.warmupIterations(3)//
		.warmupTime(TimeValue.milliseconds(1000))//
		.build();
	final Collection<RunResult> runResult = new Runner(opt).run();
	System.out.flush();
	final ResultFormat resultFormat = ResultFormatFactory.getInstance(ResultFormatType.CSV, System.out);
	resultFormat.writeOut(runResult);
	System.out.flush();
}
 
开发者ID:tools4j,项目名称:decimal4j,代码行数:25,代码来源:JmhRunner.java

示例4: main

import org.openjdk.jmh.results.RunResult; //导入依赖的package包/类
public static void main(String[] args) throws RunnerException {
    RunResult monomorphResult = makeRunner("monomorphic");
    RunResult bimorphResult = makeRunner("bimorphic");
    RunResult megamorphResult = makeRunner("megamorphic");

    RunResult inlinableMonomorphResult = makeRunner("inlinableMonomorphic");
    RunResult inlinableBimorphResult = makeRunner("inlinableBimorphic");
    RunResult inlinableMegamorphResult = makeRunner("inlinableMegamorphic");

    System.out.println("----------------------------------");
    print("Monomorphic", monomorphResult.getPrimaryResult());
    print("Bimorphic",   bimorphResult.getPrimaryResult());
    print("Megamorphic", megamorphResult.getPrimaryResult());
    print("Inlinable Monomorphic", inlinableMonomorphResult.getPrimaryResult());
    print("Inlinable Bimorphic",   inlinableBimorphResult.getPrimaryResult());
    print("Inlinable Megamorphic", inlinableMegamorphResult.getPrimaryResult());
    System.out.println("----------------------------------");
}
 
开发者ID:RichardWarburton,项目名称:java-final-benchmark,代码行数:19,代码来源:PolymorphicBenchmark.java

示例5: getResultFormater

import org.openjdk.jmh.results.RunResult; //导入依赖的package包/类
private static ResultFormat getResultFormater(final File outputFile) {
  return new ResultFormat() {
    @Override
    public void writeOut(Collection<RunResult> results) {
      try {
        PrintStream pw = new PrintStream(outputFile, "UTF-8");
        ResultFormat rf = new H2OResultFormat(pw, ",", H2O_UBENCH_GIT_SHA, H2O_UBENCH_DATE);
        rf.writeOut(results);
        pw.flush();
        pw.close();
      } catch (IOException e) {
        throw new IllegalStateException(e);
      }
    }
  };
}
 
开发者ID:h2oai,项目名称:h2o-3,代码行数:17,代码来源:H2oJmhRunner.java

示例6: testGMB

import org.openjdk.jmh.results.RunResult; //导入依赖的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

示例7: testGMB

import org.openjdk.jmh.results.RunResult; //导入依赖的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

示例8: testGMB

import org.openjdk.jmh.results.RunResult; //导入依赖的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

示例9: getInstance

import org.openjdk.jmh.results.RunResult; //导入依赖的package包/类
/**
 * Get the instance of ResultFormat of given type which writes the result to file
 * @param type result format type
 * @param file target file
 * @return result format
 */
public static ResultFormat getInstance(final ResultFormatType type, final String file) {
    return new ResultFormat() {
        @Override
        public void writeOut(Collection<RunResult> results) {
            try {
                PrintWriter pw = new PrintWriter(file);
                ResultFormat rf = getInstance(type, pw);
                rf.writeOut(results);
                pw.flush();
                pw.close();
            } catch (IOException e) {
                throw new IllegalStateException(e);
            }
        }
    };
}
 
开发者ID:msteindorfer,项目名称:jmh,代码行数:23,代码来源:ResultFormatFactory.java

示例10: create

import org.openjdk.jmh.results.RunResult; //导入依赖的package包/类
public TestResult create(final RunResult runResult, final Assertion assertion) {
	final double score = this.scoreAccessor.applyAsDouble(runResult);

	if (Double.isNaN(assertion.getLowerBound()) && Double.isNaN(assertion.getUpperBound())) {
		return new TestWithoutAssertionResult(assertion, runResult);
	} else if (Double.isNaN(score)) {
		return new TestNotExecutedResult(assertion, runResult);
	} else if (score < assertion.getLowerBound()) {
		return new TestUndercutsBoundsResult(assertion, runResult);
	} else if (score > assertion.getUpperBound()) {
		return new TestExceedsBoundsResult(assertion, runResult);
	} else {
		return new TestInBoundsResult(assertion, runResult);
	}
}
 
开发者ID:SoerenHenning,项目名称:RadarGun,代码行数:16,代码来源:TestResultFactory.java

示例11: execute

import org.openjdk.jmh.results.RunResult; //导入依赖的package包/类
@Override
protected void execute() throws RunnerException {
	// TODO exception
	final Collection<RunResult> runResults = this.runner.run();
	for (final RunResult runResult : runResults) {
		this.outputPort.send(runResult);
	}
	this.terminateStage();
}
 
开发者ID:SoerenHenning,项目名称:RadarGun,代码行数:10,代码来源:BenchmarkRunnerStage.java

示例12: testCreateTestWithoutAssertionResult

import org.openjdk.jmh.results.RunResult; //导入依赖的package包/类
@Test
public void testCreateTestWithoutAssertionResult() {
	final RunResult runResult = this.createMockedRunResult(10.0);
	final Assertion assertion = Assertion.DUMMY;
	final TestResult testResult = this.testResultFactory.create(runResult, assertion);
	assertTrue(testResult instanceof TestWithoutAssertionResult);
}
 
开发者ID:SoerenHenning,项目名称:RadarGun,代码行数:8,代码来源:TestResultFactoryTest.java

示例13: testTestUndercutsBoundsResult

import org.openjdk.jmh.results.RunResult; //导入依赖的package包/类
@Test
public void testTestUndercutsBoundsResult() {
	final RunResult runResult = this.createMockedRunResult(8.0);
	final Assertion assertion = new Assertion(9.0, 11.0);
	final TestResult testResult = this.testResultFactory.create(runResult, assertion);
	assertTrue(testResult instanceof TestUndercutsBoundsResult);
}
 
开发者ID:SoerenHenning,项目名称:RadarGun,代码行数:8,代码来源:TestResultFactoryTest.java

示例14: testTestExceedsBoundsResult

import org.openjdk.jmh.results.RunResult; //导入依赖的package包/类
@Test
public void testTestExceedsBoundsResult() {
	final RunResult runResult = this.createMockedRunResult(12.0);
	final Assertion assertion = new Assertion(9.0, 11.0);
	final TestResult testResult = this.testResultFactory.create(runResult, assertion);
	assertTrue(testResult instanceof TestExceedsBoundsResult);
}
 
开发者ID:SoerenHenning,项目名称:RadarGun,代码行数:8,代码来源:TestResultFactoryTest.java

示例15: testCreateTestInBoundsResult

import org.openjdk.jmh.results.RunResult; //导入依赖的package包/类
@Test
public void testCreateTestInBoundsResult() {
	final RunResult runResult = this.createMockedRunResult(10.0);
	final Assertion assertion = new Assertion(9.0, 11.0);
	final TestResult testResult = this.testResultFactory.create(runResult, assertion);
	assertTrue(testResult instanceof TestInBoundsResult);
}
 
开发者ID:SoerenHenning,项目名称:RadarGun,代码行数:8,代码来源:TestResultFactoryTest.java


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