Commit 65bb2fa5 authored by Noric Couderc's avatar Noric Couderc

Added method for post processing of benchmarks results

We are only interested in which data structure was the best for a given seed, so
we only keep the name of the data structure that gave the maximum throughput.
parent a227c3ff
package se.lth.cs.jmh;
import org.openjdk.jmh.results.BenchmarkResult;
import org.openjdk.jmh.results.RunResult;
import org.openjdk.jmh.results.format.ResultFormatType;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
......@@ -7,13 +10,54 @@ import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import org.openjdk.jmh.runner.options.TimeValue;
import java.util.*;
* Main function to run the jmh benchmakrs and store the results
public class Main {
public static String getResultKey(RunResult r) {
return String.format("%s,%s,%s",
public static void process(Collection<RunResult> results) {
// We group the results by seed
Map<String, List<RunResult>> resultsBySeed =
Collectors.groupingBy(it -> it.getParams().getParam("seed"))
Map<Integer, String> seedsToDatastructure = new HashMap<>();
for (String seed : resultsBySeed.keySet()) {
List<RunResult> rs = resultsBySeed.get(seed);
// We get the application with the best score
Optional<RunResult> best =
Comparator.comparing(it -> it.getAggregatedResult().getPrimaryResult().getScore())
if (best.isPresent()) {
} else {
System.out.println(new Gson().toJson(seedsToDatastructure));
public static void main(String[] args) throws RunnerException {
System.out.println("Running the custom jmh runner.");
String[] seedsText = new String[10];
for (int i = 0; i < 10; ++i)
// Preparing seeds
int number_seeds = 2;
String[] seedsText = new String[number_seeds];
for (int i = 0; i < number_seeds; ++i)
seedsText[i] = String.format("%d", i);
Options opts = new OptionsBuilder()
......@@ -24,11 +68,14 @@ public class Main {
.param("seed", seedsText)
.param("baseStructureSize", "0")
.param("applicationSize", "400")
Runner r = new Runner(opts);;
Collection<RunResult> results =;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment