use of org.openjdk.jmh.results.BenchmarkResult 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.BenchmarkResult 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.BenchmarkResult in project infinispan by infinispan.
the class BenchmarkOutputFormat method endBenchmark.
@Override
public void endBenchmark(BenchmarkResult result) {
out.writeln("");
if (result != null) {
{
Result r = result.getPrimaryResult();
String s = r.extendedInfo();
if (!s.trim().isEmpty()) {
out.writeln("Result \"" + result.getParams().getBenchmark() + "\":");
out.writeln(s);
}
}
for (Result r : result.getSecondaryResults().values()) {
String s = r.extendedInfo();
if (!s.trim().isEmpty()) {
out.writeln("Secondary result \"" + result.getParams().getBenchmark() + ":" + r.getLabel() + "\":");
out.writeln(s);
}
}
out.writeln("");
}
}
Aggregations