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

Java Result类代码示例

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

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



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

示例1: afterIteration

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

import org.openjdk.jmh.results.Result; //导入依赖的package包/类
@Override
public Collection<? extends Result> afterTrial(BenchmarkResult benchmarkResult, long l, File stdOut, File stdErr) {
    String target = Paths.get(SAVE_FLIGHT_OUTPUT_TO).resolve(benchmarkResult.getParams().getBenchmark() + "-" + currentId++ + ".jfr").toAbsolutePath().toString();

    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);

    try {
        FileUtils.copy(jfrData, target);
        pw.println("Flight Recording output saved to " + target);
    } catch (IOException e) {
        e.printStackTrace();
        pw.println("Unable to save flight output to " + target);
        pw.println("Did you miss the system property: -Djmh.jfr.saveTo ?");
    }

    pw.flush();
    pw.close();

    NoResult r = new NoResult(sw.toString());

    return Collections.singleton(r);
}
 
开发者ID:biboudis,项目名称:jmh-profilers,代码行数:24,代码来源:FlightRecordingProfiler.java


示例4: afterIteration

import org.openjdk.jmh.results.Result; //导入依赖的package包/类
@Override
public Collection<? extends Result> afterIteration(BenchmarkParams benchmarkParams, IterationParams iterationParams) {
    Map<String, Long> current = counters().getCurrent();
    return Arrays.asList(
            new ProfilerResult("@threads.alive",
                    current.get("java.threads.live"),
                    "threads", AggregationPolicy.AVG),

            new ProfilerResult("@threads.daemon",
                    current.get("java.threads.daemon"),
                    "threads", AggregationPolicy.AVG),

            new ProfilerResult("@threads.started",
                    current.get("java.threads.started"),
                    "threads", AggregationPolicy.MAX)
    );
}
 
开发者ID:msteindorfer,项目名称:jmh,代码行数:18,代码来源:HotspotThreadProfiler.java


示例5: aggregate

import org.openjdk.jmh.results.Result; //导入依赖的package包/类
@Override
public Result aggregate(Collection<StackResult> results) {
    Map<Thread.State, Multiset<StackRecord>> sum = new EnumMap<Thread.State, Multiset<StackRecord>>(Thread.State.class);
    for (StackResult r : results) {
        for (Map.Entry<Thread.State, Multiset<StackRecord>> entry : r.stacks.entrySet()) {
            if (!sum.containsKey(entry.getKey())) {
                sum.put(entry.getKey(), new HashMultiset<StackRecord>());
            }
            Multiset<StackRecord> sumSet = sum.get(entry.getKey());
            for (StackRecord rec : entry.getValue().keys()) {
                sumSet.add(rec, entry.getValue().count(rec));
            }
        }
    }
    return new StackResult(sum);
}
 
开发者ID:msteindorfer,项目名称:jmh,代码行数:17,代码来源:StackProfiler.java


示例6: afterIteration

import org.openjdk.jmh.results.Result; //导入依赖的package包/类
@Override
public Collection<? extends Result> afterIteration(BenchmarkParams benchmarkParams, IterationParams iterationParams) {
    long gcTime = 0;
    long gcCount = 0;
    for (GarbageCollectorMXBean bean : ManagementFactory.getGarbageCollectorMXBeans()) {
        gcCount += bean.getCollectionCount();
        gcTime += bean.getCollectionTime();
    }

    return Arrays.asList(
            new ProfilerResult("@gc.count.profiled", gcCount - beforeGCCount, "counts", AggregationPolicy.SUM),
            new ProfilerResult("@gc.count.total", gcCount, "counts", AggregationPolicy.MAX),
            new ProfilerResult("@gc.time.profiled", gcTime - beforeGCTime, "ms", AggregationPolicy.SUM),
            new ProfilerResult("@gc.time.total", gcTime, "ms", AggregationPolicy.MAX)
    );
}
 
开发者ID:msteindorfer,项目名称:jmh,代码行数:17,代码来源:GCProfiler.java


示例7: generateImport

import org.openjdk.jmh.results.Result; //导入依赖的package包/类
private void generateImport(PrintWriter writer) {
    Class<?>[] imports = new Class<?>[]{
            List.class, AtomicInteger.class,
            Collection.class, ArrayList.class,
            TimeUnit.class, Generated.class, CompilerControl.class,
            InfraControl.class, ThreadParams.class,
            Result.class, ThroughputResult.class, AverageTimeResult.class,
            SampleTimeResult.class, SingleShotResult.class, SampleBuffer.class,
            Mode.class, Fork.class, Measurement.class, Threads.class, Warmup.class,
            BenchmarkMode.class, RawResults.class, ResultRole.class,
            Field.class, BenchmarkParams.class, IterationParams.class
    };

    for (Class<?> c : imports) {
        writer.println("import " + c.getName() + ';');
    }
    writer.println();
}
 
开发者ID:msteindorfer,项目名称:jmh,代码行数:19,代码来源:BenchmarkGenerator.java


示例8: printLine

import org.openjdk.jmh.results.Result; //导入依赖的package包/类
private void printLine(String label, BenchmarkParams benchParams, SortedSet<String> params,
                       Map<String, String> prefixes, boolean singleUnit, Result res) {
    pw.printf("\\texttt{%s} & ", escape(prefixes.get(label)));
    for (String p : params) {
        pw.printf("\\texttt{%s}", escape(benchParams.getParam(p)));
        pw.write(" & ");
    }
    pw.printf("\\texttt{%5.3f} & ", res.getScore());
    pw.printf("\\scriptsize $\\pm$ \\texttt{%5.3f}", res.getScoreError());
    if (!singleUnit) {
        pw.printf(" & \\texttt{%s}", res.getScoreUnit());
    }
    pw.write(" \\\\");

    pw.write("\n");
}
 
开发者ID:msteindorfer,项目名称:jmh,代码行数:17,代码来源:LaTeXResultFormat.java


示例9: addLinuxVmStats

import org.openjdk.jmh.results.Result; //导入依赖的package包/类
/**
 * Parse the linux {@code /proc/self/status} and add everything prefixed with "Vm" as metric to
 * the profiling result.
 */
private static void addLinuxVmStats(List<Result> l) {
  try {
    LineNumberReader r = new LineNumberReader(new InputStreamReader(new FileInputStream("/proc/self/status")));
    String _line;
    while ((_line = r.readLine()) != null) {
      if (!_line.startsWith("Vm")) {
        continue;
      }
      String[] sa = _line.split("\\s+");
      if (sa.length != 3) {
        throw new IOException("Format error: 3 elements expected");
      }
      if (!sa[2].equals("kB")) {
        throw new IOException("Format error: unit kB expected, was: " + sa[2]);
      }
      String _name = sa[0].substring(0, sa[0].length() - 1);
      l.add(
        new ScalarResult("+linux.proc.status." + _name, (double) Long.parseLong(sa[1]), "kB", AggregationPolicy.AVG)
      );
    }
  } catch (IOException ex) {
    throw new UncheckedIOException(ex);
  }
}
 
开发者ID:cache2k,项目名称:cache2k-benchmark,代码行数:29,代码来源:LinuxVmProfiler.java


示例10: recordStats

import org.openjdk.jmh.results.Result; //导入依赖的package包/类
public static void recordStats(String _statisticsString) {
  if (before == null) {
    throw new IllegalStateException("saveStats() needs to be called before iteration.");
  }
  Stat now = extract(_statisticsString);
  long _scanCount = now.scanCount - before.scanCount;
  long _evictCount = now.evictCount - before.evictCount;
  long _getCount = now.getCount - before.getCount;
  List<Result> l = new ArrayList<>();
  l.add(new ScalarResult(RESULT_PREFIX + "scanCount", _scanCount, "counter", AggregationPolicy.AVG));
  l.add(new ScalarResult(RESULT_PREFIX + "evictCount", _evictCount, "counter", AggregationPolicy.AVG));
  l.add(new ScalarResult(RESULT_PREFIX + "getCount", _getCount, "counter", AggregationPolicy.AVG));
  if (_evictCount > 0) {
    l.add(new ScalarResult(RESULT_PREFIX + "scanPerEviction", _scanCount * 1.0D / _evictCount, "counter", AggregationPolicy.AVG));
  }
  l.forEach(MiscResultRecorderProfiler::setResult);
  before = now;
}
 
开发者ID:cache2k,项目名称:cache2k-benchmark,代码行数:19,代码来源:Cache2kMetricsRecorder.java


示例11: addLinuxVmStats

import org.openjdk.jmh.results.Result; //导入依赖的package包/类
/**
 * Parse the linux {@code /proc/self/status} and add everything prefixed with "Vm" as metric to
 * the profiling result.
 */
private static void addLinuxVmStats(List<Result> l) {
  try {
    LineNumberReader r = new LineNumberReader(new InputStreamReader(new FileInputStream("/proc/self/status")));
    String _line;
    while ((_line = r.readLine()) != null) {
      if (!_line.startsWith("Vm")) {
        continue;
      }
      String[] sa = _line.split("\\s+");
      if (sa.length != 3) {
        throw new IOException("Format error: 3 elements expected");
      }
      if (!sa[2].equals("kB")) {
        throw new IOException("Format error: unit kB expected, was: " + sa[2]);
      }
      String _name = sa[0].substring(0, sa[0].length() - 1);
      l.add(
        new ScalarResult("+forced-gc-mem.used." + _name, (double) Long.parseLong(sa[1]), "kB", AggregationPolicy.AVG)
      );
    }
  } catch (IOException ex) {
    throw new UncheckedIOException(ex);
  }
}
 
开发者ID:cache2k,项目名称:cache2k-benchmark,代码行数:29,代码来源:ForcedGcMemoryProfiler.java


示例12: afterIteration

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


示例13: afterIteration

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


示例14: afterTrial

import org.openjdk.jmh.results.Result; //导入依赖的package包/类
@Override
public Collection<? extends Result> afterTrial(BenchmarkParams benchmarkParams, File stdOut, File stdErr) {
    try {
        return Arrays.asList(
                new LogConsumeResult("out", FileUtils.readAllLines(stdOut)),
                new LogConsumeResult("err", FileUtils.readAllLines(stdErr))
        );
    } catch (IOException e) {
        // skip
    }
    return Collections.emptyList();
}
 
开发者ID:msteindorfer,项目名称:jmh,代码行数:13,代码来源:LogConsumeProfiler.java


示例15: aggregate

import org.openjdk.jmh.results.Result; //导入依赖的package包/类
@Override
public Result aggregate(Collection<LogConsumeResult> results) {
    String label = null;
    Collection<String> allLines = new ArrayList<String>();
    for (LogConsumeResult r : results) {
        label = r.label;
        allLines.addAll(r.getLines());
    }
    return new LogConsumeResult(label, allLines);
}
 
开发者ID:msteindorfer,项目名称:jmh,代码行数:11,代码来源:LogConsumeProfiler.java


示例16: aggregate

import org.openjdk.jmh.results.Result; //导入依赖的package包/类
@Override
public Result aggregate(Collection<PerfResult> results) {
    String output = "";
    for (PerfResult r : results) {
        output += r.output;
    }
    return new PerfResult(output);
}
 
开发者ID:msteindorfer,项目名称:jmh,代码行数:9,代码来源:LinuxPerfAsmProfiler.java


示例17: aggregate

import org.openjdk.jmh.results.Result; //导入依赖的package包/类
@Override
public Result aggregate(Collection<PerfResult> results) {
    long cycles = 0;
    long instructions = 0;
    String output = "";
    for (PerfResult r : results) {
        cycles += r.cycles;
        instructions += r.instructions;
        output += r.output;
    }
    return new PerfResult(output, cycles, instructions);
}
 
开发者ID:msteindorfer,项目名称:jmh,代码行数:13,代码来源:LinuxPerfProfiler.java


示例18: afterIteration

import org.openjdk.jmh.results.Result; //导入依赖的package包/类
@Override
public Collection<? extends Result> afterIteration(BenchmarkParams benchmarkParams, IterationParams iterationParams) {
    long compTime = -startCompTime;
    CompilationMXBean comp = ManagementFactory.getCompilationMXBean();
    try {
        compTime += comp.getTotalCompilationTime();
    } catch (UnsupportedOperationException e) {
        compTime = -1;
    }

    return Arrays.asList(
            new ProfilerResult("@compiler.time.profiled", compTime, "ms", AggregationPolicy.SUM),
            new ProfilerResult("@compiler.time.total", comp.getTotalCompilationTime(), "ms", AggregationPolicy.MAX)
    );
}
 
开发者ID:msteindorfer,项目名称:jmh,代码行数:16,代码来源:CompilerProfiler.java


示例19: aggregate

import org.openjdk.jmh.results.Result; //导入依赖的package包/类
@Override
public Result aggregate(Collection<ProfilerResult> results) {
    ListStatistics stats = new ListStatistics();
    for (ProfilerResult r : results) {
        stats.addValue(r.getScore());
    }
    return new ProfilerResult(
            AggregatorUtils.aggregateLabels(results),
            stats,
            AggregatorUtils.aggregateUnits(results),
            AggregatorUtils.aggregatePolicies(results)
    );
}
 
开发者ID:msteindorfer,项目名称:jmh,代码行数:14,代码来源:ProfilerResultAggregator.java


示例20: afterIteration

import org.openjdk.jmh.results.Result; //导入依赖的package包/类
@Override
public Collection<? extends Result> afterIteration(BenchmarkParams benchmarkParams, IterationParams iterationParams) {
    HotspotInternalResult res = counters();
    Collection<ProfilerResult> results = new ArrayList<ProfilerResult>();
    for (Map.Entry<String, Long> e : res.getDiff().entrySet()) {
        results.add(new ProfilerResult("@unknown." + e.getKey(), e.getValue(), "unit?", AggregationPolicy.AVG));
    }
    return results;
}
 
开发者ID:msteindorfer,项目名称:jmh,代码行数:10,代码来源:AbstractHotspotProfiler.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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