use of org.openjdk.jmh.results.IterationResult in project pie by metaborg.
the class PieMetricsProfiler method afterIteration.
@Override
public Collection<? extends Result> afterIteration(BenchmarkParams benchmarkParams, IterationParams iterationParams, IterationResult result) {
final ArrayList<Result> results = new ArrayList<>();
if (!measurementsActive)
return results;
final TimeUnit targetTimeUnit = benchmarkParams.getTimeUnit();
for (Measurement measurement : measurements) {
results.add(measurement.createSingleShotResult("systemNanoTime", measurement.time.systemNanoTime, targetTimeUnit));
results.add(measurement.createSingleShotResult("threadCpuTime", measurement.time.threadCpuTime, targetTimeUnit));
results.add(measurement.createSingleShotResult("threadUserTime", measurement.time.threadUserTime, targetTimeUnit));
if (measurement.report != null) {
results.add(measurement.createAvgScalarResult("providedResources", measurement.report.totalProvidedResources, "resources"));
results.add(measurement.createAvgScalarResult("requiredResources", measurement.report.totalRequiredResources, "resources"));
results.add(measurement.createAvgScalarResult("requiredTasks", measurement.report.totalRequiredTasks, "tasks"));
results.add(measurement.createAvgScalarResult("checkedProvidedResourceDependencies", measurement.report.totalCheckedProvidedResourceDependencyCount, "dependencies"));
results.add(measurement.createAvgScalarResult("checkedRequiredResourceDependencies", measurement.report.totalCheckedRequiredResourceDependencyCount, "dependencies"));
results.add(measurement.createAvgScalarResult("checkedRequiredTaskDependencies", measurement.report.totalCheckedRequiredTaskDependencyCount, "dependencies"));
results.add(measurement.createAvgScalarResult("executedTasks", measurement.report.totalExecutionCount, "tasks"));
}
}
measurementsActive = false;
return results;
}
use of org.openjdk.jmh.results.IterationResult in project kie-benchmarks by kiegroup.
the class MemoryConsumptionProfiler method afterIteration.
@Override
public Collection<? extends Result> afterIteration(BenchmarkParams benchmarkParams, IterationParams iterationParams, IterationResult result) {
if (!proceedWithMetrics.get()) {
return Collections.EMPTY_LIST;
}
final UsedMemory usedMemory;
try {
usedMemory = getUsedMemoryAfterSettling();
} catch (IllegalStateException ex) {
logger.error("{0} deactivated due to error during metrics recording.", getClass().getSimpleName(), ex);
return Collections.EMPTY_LIST;
}
final List<Result> results = new ArrayList<>();
final double usedHeap = bytesToKB(usedMemory.usedHeapMemory);
final double usedNonHeap = bytesToKB(usedMemory.usedNonHeapMemory);
final double total = bytesToKB(usedMemory.totalCommittedMemory);
final double metaSpace = bytesToKB(usedMemory.metaSpaceMemory);
results.add(new ScalarResult("mem.used.heap", usedHeap, "kB", AggregationPolicy.AVG));
results.add(new ScalarResult("mem.used.nonheap", usedNonHeap, "kB", AggregationPolicy.AVG));
results.add(new ScalarResult("mem.total", total, "kB", AggregationPolicy.AVG));
results.add(new ScalarResult("mem.used.metaspace", metaSpace, "kB", AggregationPolicy.AVG));
return results;
}
use of org.openjdk.jmh.results.IterationResult in project deephaven-core by deephaven.
the class CsvResultWriter method recordResults.
public static void recordResults(final Collection<RunResult> results, final File file) {
if (results.isEmpty()) {
return;
}
final CsvWriter writer = new CsvWriter(file, new CsvWriterSettings());
final Set<String> headers = new LinkedHashSet<>();
headers.add("Benchmark");
headers.add("Run");
headers.add("Iteration");
headers.add("Score");
for (final RunResult runResult : results) {
final BenchmarkParams runParams = runResult.getParams();
headers.addAll(runParams.getParamsKeys());
}
writer.writeHeaders(headers);
final DecimalFormat decimalFormat = new DecimalFormat("#0.000");
int runNo = 0;
for (final RunResult runResult : results) {
final BenchmarkParams runParams = runResult.getParams();
for (final BenchmarkResult benchResult : runResult.getBenchmarkResults()) {
runNo++;
int itNo = 0;
for (final IterationResult itResult : benchResult.getIterationResults()) {
itNo++;
final Map<String, String> values = new HashMap<>();
values.put("Benchmark", runParams.getBenchmark());
for (String key : runParams.getParamsKeys()) {
values.put(key, runParams.getParam(key));
}
values.put("Score", decimalFormat.format(itResult.getPrimaryResult().getScore()));
values.put("Run", Integer.toString(runNo));
values.put("Iteration", Integer.toString(itNo));
writer.writeRow(headers.stream().map(values::get).collect(Collectors.toList()));
}
}
}
writer.close();
}
use of org.openjdk.jmh.results.IterationResult in project deephaven-core by deephaven.
the class BenchmarkRunner method recordResults.
private static void recordResults(Collection<RunResult> results) {
if (results.isEmpty()) {
return;
}
// Write an in mem table, load the per iteration tables, nj them, write to disk
final TableBuilder builder = new TableBuilder(RESULT_TABLE_DEF);
int runNo = 0;
for (final RunResult runResult : results) {
final BenchmarkParams runParams = runResult.getParams();
final String paramString = BenchmarkTools.buildParameterString(runParams);
final String benchmarkName = BenchmarkTools.getStrippedBenchmarkName(runParams);
final String modeString = BenchmarkTools.getModeString(runParams);
for (final BenchmarkResult benchResult : runResult.getBenchmarkResults()) {
int itNo = 0;
for (final IterationResult itResult : benchResult.getIterationResults()) {
builder.addRow(benchmarkName, modeString, itNo++, paramString, runNo, filterDouble(itResult.getPrimaryResult().getScore()), (long) (itResult.getSecondaryResults().get("Max heap").getScore()), (long) (itResult.getSecondaryResults().get("Max free heap").getScore()), (long) (itResult.getSecondaryResults().get("Max used heap").getScore()), (long) (itResult.getSecondaryResults().get("Max threads").getScore()), filterDouble(itResult.getSecondaryResults().get("Max CPU").getScore()));
}
runNo++;
}
}
final Table topLevel = builder.build();
final Table mergedDetails = getMergedDetails();
final Table result = topLevel.naturalJoin(mergedDetails, "Benchmark,Mode,Run,Iteration,Params");
final Path outputPath = Paths.get(BenchmarkTools.getLogPath()).resolve("Benchmark" + ParquetTableWriter.PARQUET_FILE_EXTENSION);
ParquetTools.writeTable(result, outputPath.toFile(), result.getDefinition());
}
use of org.openjdk.jmh.results.IterationResult in project aws-greengrass-nucleus by aws-greengrass.
the class MiscResultRecorderProfiler method afterIteration.
@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(all::add);
all.addAll(results.values());
return all;
}
Aggregations