本文整理汇总了Java中org.openjdk.jmh.results.AggregationPolicy类的典型用法代码示例。如果您正苦于以下问题:Java AggregationPolicy类的具体用法?Java AggregationPolicy怎么用?Java AggregationPolicy使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AggregationPolicy类属于org.openjdk.jmh.results包,在下文中一共展示了AggregationPolicy类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: afterIteration
import org.openjdk.jmh.results.AggregationPolicy; //导入依赖的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.AggregationPolicy; //导入依赖的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.AggregationPolicy; //导入依赖的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
示例4: afterIteration
import org.openjdk.jmh.results.AggregationPolicy; //导入依赖的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
示例5: addLinuxVmStats
import org.openjdk.jmh.results.AggregationPolicy; //导入依赖的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
示例6: tearDown
import org.openjdk.jmh.results.AggregationPolicy; //导入依赖的package包/类
@TearDown(Level.Iteration)
public void tearDown() {
synchronized (LOCK) {
if (hitCount > 0) {
addCounterResult("hitCount", hitCount, "hit", AggregationPolicy.AVG);
}
if (missCount > 0) {
addCounterResult("missCount", missCount, "miss", AggregationPolicy.AVG);
}
if (opCount == 0) {
opCount = hitCount + missCount;
}
addCounterResult("opCount", opCount, "op", AggregationPolicy.AVG);
updateHitrate("tearDown(), hitCount=" + hitCount + ", missCount=" + missCount + ", opCount=" + opCount);
hitCount = missCount = opCount = 0;
}
}
开发者ID:cache2k,项目名称:cache2k-benchmark,代码行数:18,代码来源:HitCountRecorder.java
示例7: recordStats
import org.openjdk.jmh.results.AggregationPolicy; //导入依赖的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
示例8: addLinuxVmStats
import org.openjdk.jmh.results.AggregationPolicy; //导入依赖的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
示例9: afterIteration
import org.openjdk.jmh.results.AggregationPolicy; //导入依赖的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
示例10: afterIteration
import org.openjdk.jmh.results.AggregationPolicy; //导入依赖的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
示例11: afterIteration
import org.openjdk.jmh.results.AggregationPolicy; //导入依赖的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
示例12: afterIteration
import org.openjdk.jmh.results.AggregationPolicy; //导入依赖的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
示例13: recordOpCount
import org.openjdk.jmh.results.AggregationPolicy; //导入依赖的package包/类
public static void recordOpCount(long _opCount) {
synchronized (LOCK) {
addCounterResult(
"opCount", _opCount, "op", AggregationPolicy.AVG
);
updateHitrate("ops=" + _opCount);
}
}
开发者ID:cache2k,项目名称:cache2k-benchmark,代码行数:9,代码来源:HitCountRecorder.java
示例14: recordMissCount
import org.openjdk.jmh.results.AggregationPolicy; //导入依赖的package包/类
public static void recordMissCount(long _missCount) {
synchronized (LOCK) {
addCounterResult(
"missCount", _missCount, "op", AggregationPolicy.AVG
);
updateHitrate("miss=" + _missCount);
}
}
开发者ID:cache2k,项目名称:cache2k-benchmark,代码行数:9,代码来源:HitCountRecorder.java
示例15: updateHitrate
import org.openjdk.jmh.results.AggregationPolicy; //导入依赖的package包/类
/** Called for each thread */
private static void updateHitrate(String s) {
long _missCountSum = getCounterResult("missCount");
long _opCountSum = getCounterResult("opCount");
if (_opCountSum == 0L) {
return;
}
double _hitRate = 100.0 - _missCountSum * 100.0 / _opCountSum;
System.err.println(Thread.currentThread() + " " + s + ", opSum=" + _opCountSum + ", missSum=" + _missCountSum + ", hitRate=" + _hitRate);
setResult("hitrate", _hitRate, "percent", AggregationPolicy.AVG);
}
开发者ID:cache2k,项目名称:cache2k-benchmark,代码行数:12,代码来源:HitCountRecorder.java
示例16: addCounterResult
import org.openjdk.jmh.results.AggregationPolicy; //导入依赖的package包/类
/**
* Insert the counter value as secondary result. If a value is already inserted the
* counter value is added to the existing one. This can be used to collect and sum up
* results from different threads.
*/
public static void addCounterResult(String key, long _counter, String _unit, AggregationPolicy _aggregationPolicy) {
CounterResult r = counters.computeIfAbsent(key, any -> new CounterResult());
r.aggregationPolicy = _aggregationPolicy;
r.unit = _unit;
r.counter.addAndGet(_counter);
r.key = key;
}
开发者ID:cache2k,项目名称:cache2k-benchmark,代码行数:13,代码来源:MiscResultRecorderProfiler.java
示例17: NoResult
import org.openjdk.jmh.results.AggregationPolicy; //导入依赖的package包/类
public NoResult(String output) {
super(ResultRole.SECONDARY, "JFR", of(Double.NaN), "N/A", AggregationPolicy.SUM);
this.output = output;
}
开发者ID:biboudis,项目名称:jmh-profilers,代码行数:6,代码来源:FlightRecordingProfiler.java
示例18: LogConsumeResult
import org.openjdk.jmh.results.AggregationPolicy; //导入依赖的package包/类
public LogConsumeResult(String label, Collection<String> lines) {
super(ResultRole.SECONDARY, "log" + label, of(Double.NaN), "N/A", AggregationPolicy.MAX);
this.lines = lines;
}
开发者ID:msteindorfer,项目名称:jmh,代码行数:5,代码来源:LogConsumeProfiler.java
示例19: ProfilerResult
import org.openjdk.jmh.results.AggregationPolicy; //导入依赖的package包/类
public ProfilerResult(String label, double n, String unit, AggregationPolicy policy) {
this(label, of(n), unit, policy);
}
开发者ID:msteindorfer,项目名称:jmh,代码行数:4,代码来源:ProfilerResult.java
示例20: afterIteration
import org.openjdk.jmh.results.AggregationPolicy; //导入依赖的package包/类
@Override
public Collection<? extends Result> afterIteration(BenchmarkParams benchmarkParams, IterationParams iterationParams) {
Map<String, Long> current = counters().getCurrent();
return Arrays.asList(
new ProfilerResult("@compiler.totalTime",
TimeUnit.NANOSECONDS.toMillis(current.get("java.ci.totalTime")),
"ms", AggregationPolicy.MAX),
new ProfilerResult("@compiler.totalCompiles",
current.get("sun.ci.totalCompiles"),
"methods", AggregationPolicy.MAX),
new ProfilerResult("@compiler.totalBailouts",
current.get("sun.ci.totalBailouts"),
"methods", AggregationPolicy.MAX),
new ProfilerResult("@compiler.totalInvalidates",
current.get("sun.ci.totalInvalidates"),
"methods", AggregationPolicy.MAX),
new ProfilerResult("@compiler.nmethodCodeSize",
current.get("sun.ci.nmethodCodeSize")/ 1024,
"Kb", AggregationPolicy.MAX),
new ProfilerResult("@compiler.nmethodSize",
current.get("sun.ci.nmethodSize") / 1024,
"Kb", AggregationPolicy.MAX),
new ProfilerResult("@compiler.osrCompiles",
current.get("sun.ci.osrCompiles"),
"methods", AggregationPolicy.MAX),
new ProfilerResult("@compiler.osrBytes",
current.get("sun.ci.osrBytes") / 1024,
"Kb", AggregationPolicy.MAX),
new ProfilerResult("@compiler.osrTime",
TimeUnit.NANOSECONDS.toMillis(current.get("sun.ci.osrTime")),
"ms", AggregationPolicy.MAX),
new ProfilerResult("@compiler.standardCompiles",
current.get("sun.ci.standardCompiles"),
"methods", AggregationPolicy.MAX),
new ProfilerResult("@compiler.standardBytes",
current.get("sun.ci.standardBytes") / 1024,
"Kb", AggregationPolicy.MAX),
new ProfilerResult("@compiler.standardTime",
TimeUnit.NANOSECONDS.toMillis(current.get("sun.ci.standardTime")),
"ms", AggregationPolicy.MAX)
);
}
开发者ID:msteindorfer,项目名称:jmh,代码行数:54,代码来源:HotspotCompilationProfiler.java
注:本文中的org.openjdk.jmh.results.AggregationPolicy类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论