• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java IterationResult类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: afterIteration

import org.openjdk.jmh.results.IterationResult; //导入依赖的package包/类
@Override
public Collection<? extends Result> afterIteration(BenchmarkParams benchmarkParams,
                                                   IterationParams iterationParams,
                                                   IterationResult result) {
    final ArrayList<Result> results = Lists.newArrayList();
    if (metricRegistry == null) {
        return results;
    }
    final SortedMap<String, Meter> counters = metricRegistry.getMeters((name, metric) -> {
        return name.startsWith(MetricRegistry.name(Rule.class)) || name.startsWith(MetricRegistry.name(Pipeline.class));
    });
    counters.entrySet()
            .forEach(stringCounterEntry -> result.addResult(new ScalarResult(stringCounterEntry.getKey(),
                                                                             stringCounterEntry.getValue().getCount(),
                                                                             "calls",
                                                                             AggregationPolicy.SUM)));

    return results;
}
 
开发者ID:Graylog2,项目名称:graylog-plugin-pipeline-processor,代码行数:20,代码来源:PipelinePerformanceBenchmarks.java


示例2: afterIteration

import org.openjdk.jmh.results.IterationResult; //导入依赖的package包/类
@Override
public Collection<? extends Result> afterIteration(BenchmarkParams benchmarkParams,
    IterationParams iterationParams, IterationResult result) {
  final Runtime runtime = Runtime.getRuntime();

  final long max = runtime.maxMemory();
  final long total = runtime.totalMemory();
  final long free = runtime.freeMemory();
  final long used = total - free;

  return Arrays
      .asList(new ProfilerResult(PREFIX + "rt.mem.max", max, "bytes", AggregationPolicy.MAX),
          new ProfilerResult(PREFIX + "rt.mem.total", total, "bytes", AggregationPolicy.MAX),
          new ProfilerResult(PREFIX + "rt.mem.free", free, "bytes", AggregationPolicy.MAX),
          new ProfilerResult(PREFIX + "rt.mem.used", used, "bytes", AggregationPolicy.MAX));
}
 
开发者ID:bramp,项目名称:unsafe,代码行数:17,代码来源:MemoryProfiler.java


示例3: afterIteration

import org.openjdk.jmh.results.IterationResult; //导入依赖的package包/类
@Override
public Collection<? extends Result> afterIteration(final BenchmarkParams benchmarkParams, final IterationParams iterationParams, final IterationResult result) {
  if (usedMemory <= 0) {
    recordUsedMemory();
    if (usedMemory <= 0) {
      return Collections.emptyList();
    }
  }
  List<Result> l = new ArrayList<>();
  addLinuxVmStats(l);
  l.addAll(Arrays.asList(
    new ScalarResult("+forced-gc-mem.used.settled", (double) usedMemorySettled, "bytes", AggregationPolicy.AVG),
    new ScalarResult("+forced-gc-mem.used.after", (double) usedMemory, "bytes", AggregationPolicy.AVG),
    new ScalarResult("+forced-gc-mem.total", (double) totalMemory, "bytes", AggregationPolicy.AVG),
    new ScalarResult("+forced-gc-mem.gcTimeMillis", (double) gcTimeMillis, "ms", AggregationPolicy.AVG),
    new ScalarResult("+forced-gc-mem.usedHeap", (double) usedHeapMemory, "bytes", AggregationPolicy.AVG)
  ));
  keepReference = null;
  return l;
}
 
开发者ID:cache2k,项目名称:cache2k-benchmark,代码行数:21,代码来源:ForcedGcMemoryProfiler.java


示例4: createMockedRunResult

import org.openjdk.jmh.results.IterationResult; //导入依赖的package包/类
private RunResult createMockedRunResult(final double value) {
	final IterationResult iterationResult = new IterationResult(null, null, null);
	iterationResult.addResult(new SingleShotResult(ResultRole.PRIMARY, "", (long) value, TimeUnit.NANOSECONDS));
	final Collection<IterationResult> iterationResults = Arrays.asList(iterationResult);
	final BenchmarkResult benchmarkResult = new BenchmarkResult(null, iterationResults);
	final Collection<BenchmarkResult> benchmarkResults = Arrays.asList(benchmarkResult);
	return new RunResult(null, benchmarkResults);
}
 
开发者ID:SoerenHenning,项目名称:RadarGun,代码行数:9,代码来源:TestResultFactoryTest.java


示例5: afterIteration

import org.openjdk.jmh.results.IterationResult; //导入依赖的package包/类
/**
 * Run this code after a benchmark iteration finished
 *
 * @param benchmarkParams benchmark parameters used for current launch
 * @param iterationParams iteration parameters used for current launch
 * @param result iteration result
 * @return profiler results
 */
@Override
public Collection<? extends Result<ProfilerResult>> afterIteration(
    BenchmarkParams benchmarkParams, IterationParams iterationParams, IterationResult result) {
  String unit = "invocations";
  AggregationPolicy policy = AggregationPolicy.AVG;

  final ProfilerResult hashCodeResult =
      new ProfilerResult("hashCode", CountingInteger.getHashcodeCounter(), unit, policy);

  final ProfilerResult equalsResult =
      new ProfilerResult("equals", CountingInteger.getEqualsCounter(), unit, policy);

  return Arrays.asList(hashCodeResult, equalsResult);
}
 
开发者ID:msteindorfer,项目名称:criterion,代码行数:23,代码来源:CountingIntegerProfiler.java


示例6: stopProfilers

import org.openjdk.jmh.results.IterationResult; //导入依赖的package包/类
protected void stopProfilers(BenchmarkParams benchmarkParams, IterationParams iterationParams, IterationResult iterationResults) {
    // stop profilers
    for (InternalProfiler prof : registeredProfilers) {
        try {
            iterationResults.addResults(prof.afterIteration(benchmarkParams, iterationParams));
        } catch (Throwable ex) {
            throw new BenchmarkException(ex);
        }
    }
}
 
开发者ID:msteindorfer,项目名称:jmh,代码行数:11,代码来源:BaseBenchmarkHandler.java


示例7: afterIteration

import org.openjdk.jmh.results.IterationResult; //导入依赖的package包/类
@Override
public Collection<? extends Result> afterIteration(final BenchmarkParams benchmarkParams, final IterationParams iterationParams, final IterationResult result) {
  List<Result<?>> all = new ArrayList<>();
  counters.values().stream()
    .map(e ->
      new ScalarResult(SECONDARY_RESULT_PREFIX + e.key, (double) e.counter.get(), e.unit, e.aggregationPolicy))
    .sequential().forEach(e -> all.add(e));
  all.addAll(results.values());
  return all;
}
 
开发者ID:cache2k,项目名称:cache2k-benchmark,代码行数:11,代码来源:MiscResultRecorderProfiler.java


示例8: getTimes

import org.openjdk.jmh.results.IterationResult; //导入依赖的package包/类
private List<Double> getTimes(String algorithmId,
                              String datasetId,
                              int warmUps,
                              int measurements) throws CLIWrapperException, RunnerException {
    Options options = new OptionsBuilder()
            .forks(1)
            .measurementIterations(measurements)
            .warmupIterations(warmUps)
            .param("datasetId", datasetId)
            .param("algorithmId", algorithmId)
            .include(JMHBenchmark.class.getName())
            .build();

    Collection<RunResult> results = new Runner(options).run();
    List<Double> times = new ArrayList<>();
    for (RunResult result : results) {
        for (BenchmarkResult benchmarkResult : result.getBenchmarkResults()) {
            BenchmarkParams params = benchmarkResult.getParams();
            String myDatasetId = params.getParam("datasetId");
            if (!datasetId.equals(myDatasetId)) {
                throw new CLIWrapperException("Unable to dig through JMH output: Value for 'datasetId' parameter is '"
                        + myDatasetId + "' but expected '" + datasetId + "'", null);
            }
            String myAlgorithmId = params.getParam("algorithmId");
            if (!algorithmId.equals(myAlgorithmId)) {
                throw new CLIWrapperException("Unable to dig through JMH output: Value for 'algorithmId' parameter is '"
                        + myAlgorithmId + "' but expected '" + algorithmId + "'", null);
            }
            int count = 0;
            for (IterationResult iterationResult : benchmarkResult.getIterationResults()) {
                for (Result<?> primary : iterationResult.getRawPrimaryResults()) {
                    if (primary.getStatistics().getN() != 1) {
                        throw new CLIWrapperException("Unable to dig through JMH output: getN() != 1", null);
                    }
                    if (!primary.getScoreUnit().equals("us/op")) {
                        throw new CLIWrapperException("Unable to dig through JMH output: getScoreUnit() = " + primary.getScoreUnit(), null);
                    }
                    double value = primary.getScore() / 1e6;
                    times.add(value / IdCollection.getDataset(datasetId).getNumberOfInstances());
                    ++count;
                }
            }
            if (count != measurements) {
                throw new CLIWrapperException("Unable to dig through JMH output: Expected "
                        + measurements + " measurements, found " + count, null);
            }
        }
    }
    return times;
}
 
开发者ID:mbuzdalov,项目名称:non-dominated-sorting,代码行数:51,代码来源:Benchmark.java


示例9: afterIteration

import org.openjdk.jmh.results.IterationResult; //导入依赖的package包/类
/**
   * Run this code after a benchmark iteration finished
   *
   * @param benchmarkParams benchmark parameters used for current launch
   * @param iterationParams iteration parameters used for current launch
   * @param result iteration result
   * @return profiler results
   */
  @Override
  public Collection<? extends Result<ProfilerResult>> afterIteration(
      BenchmarkParams benchmarkParams, IterationParams iterationParams, IterationResult result) {

    try {
      final String benchmarkClassName = benchmarkToClassName(benchmarkParams.getBenchmark());
      final Method factoryMethod = factoryMethod(benchmarkClassName);

      final JmhValue wrappedObject =
          (JmhValue) factoryMethod.invoke(null, initializeArguments(benchmarkParams));
      final Object objectToMeasure = wrappedObject.unwrap();

      final Predicate<Object> predicateDataStructureOverhead =
          Predicates.not(Predicates.instanceOf(JmhValue.class));
      final Predicate<Object> predicateRetainedSize = Predicates.alwaysTrue();

      final List<ProfilerResult> profilerResults = new ArrayList<>();

      /**
       * Traverse object graph for measuring memory footprint (in bytes).
       */
      long memoryInBytes = objectexplorer.MemoryMeasurer
          .measureBytes(objectToMeasure, predicateDataStructureOverhead);

      // NOTE: non-standard constructor for passing ResultRole.PRIMARY
      final ProfilerResult memoryResult =
          new ProfilerResult(ResultRole.PRIMARY, "memory", memoryInBytes, UNIT_BYTES, POLICY);

      // hack: substitute results
      result.resetResults();
      result.addResult(memoryResult);

//      /**
//       * Traverse object graph for measuring field statistics.
//       */
//      final Footprint statistic = objectexplorer.ObjectGraphMeasurer
//          .measure(objectToMeasure, predicateDataStructureOverhead);
//
//      final ProfilerResult objectsResult =
//          new ProfilerResult("objects", statistic.getObjects(), UNIT_COUNT, POLICY);
//      profilerResults.add(objectsResult);
//
//      final ProfilerResult referencesResult =
//          new ProfilerResult("references", statistic.getReferences(), UNIT_COUNT, POLICY);
//      profilerResults.add(referencesResult);
//
//      final ProfilerResult primitivesResult =
//          new ProfilerResult("primitives", statistic.getPrimitives().size(), UNIT_COUNT, POLICY);
//      profilerResults.add(primitivesResult);

      return profilerResults;
    } catch (Exception e) {
      e.printStackTrace();
      return Arrays.asList();
    }
  }
 
开发者ID:msteindorfer,项目名称:criterion,代码行数:65,代码来源:MemoryFootprintProfiler.java


示例10: getStub

import org.openjdk.jmh.results.IterationResult; //导入依赖的package包/类
private Collection<RunResult> getStub() {
    Collection<RunResult> results = new TreeSet<RunResult>(RunResult.DEFAULT_SORT_COMPARATOR);

    Random r = new Random(12345);
    for (int b = 0; b < r.nextInt(10); b++) {
        WorkloadParams ps = new WorkloadParams();
        for (int p = 0; p < 5; p++) {
            ps.put("param" + p, "value" + p, p);
        }
        BenchmarkParams params = new BenchmarkParams(
                "benchmark_" + b,
                JSONResultFormat.class.getName() + ".benchmark_" + b + "_" + Mode.Throughput,
                false,
                r.nextInt(1000),
                new int[]{ r.nextInt(1000) },
                r.nextInt(1000),
                r.nextInt(1000),
                new IterationParams(IterationType.WARMUP,      r.nextInt(1000), TimeValue.seconds(r.nextInt(1000)), 1),
                new IterationParams(IterationType.MEASUREMENT, r.nextInt(1000), TimeValue.seconds(r.nextInt(1000)), 1),
                Mode.Throughput,
                ps,
                TimeUnit.SECONDS, 1,
                Utils.getCurrentJvm(),
                Collections.<String>emptyList(),
                TimeValue.days(1));

        Collection<BenchmarkResult> benchmarkResults = new ArrayList<BenchmarkResult>();
        for (int f = 0; f < r.nextInt(10); f++) {
            Collection<IterationResult> iterResults = new ArrayList<IterationResult>();
            for (int c = 0; c < r.nextInt(10); c++) {
                IterationResult res = new IterationResult(params, params.getMeasurement());
                res.addResult(new ThroughputResult(ResultRole.PRIMARY, "test", r.nextInt(1000), 1000 * 1000, TimeUnit.MILLISECONDS));
                res.addResult(new ThroughputResult(ResultRole.SECONDARY, "secondary1", r.nextInt(1000), 1000 * 1000, TimeUnit.MILLISECONDS));
                res.addResult(new ThroughputResult(ResultRole.SECONDARY, "secondary2", r.nextInt(1000), 1000 * 1000, TimeUnit.MILLISECONDS));
                iterResults.add(res);
            }
            benchmarkResults.add(new BenchmarkResult(iterResults));
        }
        results.add(new RunResult(benchmarkResults));
    }
    return results;
}
 
开发者ID:msteindorfer,项目名称:jmh,代码行数:43,代码来源:ResultFormatTest.java


示例11: afterIteration

import org.openjdk.jmh.results.IterationResult; //导入依赖的package包/类
@Override
public Collection<? extends Result> afterIteration(final BenchmarkParams benchmarkParams, final IterationParams iterationParams, final IterationResult result) {
  List<Result> l = new ArrayList<>();
  addLinuxVmStats(l);
  return l;
}
 
开发者ID:cache2k,项目名称:cache2k-benchmark,代码行数:7,代码来源:LinuxVmProfiler.java


示例12: iterationResult

import org.openjdk.jmh.results.IterationResult; //导入依赖的package包/类
@Override
public void iterationResult(BenchmarkParams benchmarkParams, IterationParams params, int iteration, IterationResult data) {

}
 
开发者ID:msteindorfer,项目名称:jmh,代码行数:5,代码来源:SilentFormat.java


示例13: iterationResult

import org.openjdk.jmh.results.IterationResult; //导入依赖的package包/类
/**
 * Format for end-of-iteration.
 *
 * @param benchParams      name of benchmark
 * @param params    iteration params in use
 * @param iteration iteration-number
 * @param data    result of iteration
 */
public void iterationResult(BenchmarkParams benchParams, IterationParams params, int iteration, IterationResult data);
 
开发者ID:msteindorfer,项目名称:jmh,代码行数:10,代码来源:OutputFormat.java


示例14: runIteration

import org.openjdk.jmh.results.IterationResult; //导入依赖的package包/类
/**
 * Runs an iteration on the handled benchmark.
 *
 * @param benchmarkParams Benchmark parameters
 * @param params  Iteration parameters
 * @param last    Should this iteration considered to be the last
 * @return IterationResult
 */
public IterationResult runIteration(BenchmarkParams benchmarkParams, IterationParams params, boolean last);
 
开发者ID:msteindorfer,项目名称:jmh,代码行数:10,代码来源:BenchmarkHandler.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java IntrusiveCollection类代码示例发布时间:2022-05-22
下一篇:
Java LeftJoin类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap