Commit f5d12553 authored by Noric Couderc's avatar Noric Couderc
Browse files

Fixed bug in printing of features

Erroneously ran the square of the needed benchmarks, and duplicated
data.
parent 29ddd3ec
......@@ -99,9 +99,7 @@ open class PapiRunner(numRuns : Int, counters: CounterSpecification) {
for (c in counters) {
val eventSet = EventSet.create(c.value)
for (b in syntheticBenchmarks) {
for (i in 0 until numRuns) {
specification.add(RunSpec(i, c.key, eventSet, b))
}
specification.add(RunSpec(numRuns, c.key, eventSet, b))
}
}
return specification.toList()
......@@ -111,7 +109,7 @@ open class PapiRunner(numRuns : Int, counters: CounterSpecification) {
val writer = FileWriter("/dev/null")
val samples = mutableListOf<Long>()
for (i in 0 until numRuns) {
for (i in 0 until spec.numRuns) {
val app = spec.syntheticBenchmark
val evset = spec.eventSet
// We do the measurements
......
......@@ -17,6 +17,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.IntPredicate;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
......@@ -96,6 +97,26 @@ public class PapiRunnerTest {
}
}
@Test
public void testPapiRunBenchmarkMedian() {
MapSyntheticBenchmark bench = new MapSyntheticBenchmark(0, 100, new HashMap());
ArrayList<SyntheticBenchmark<?>> benches = new ArrayList<>();
benches.add(bench);
List<Triple<SyntheticBenchmark<?>, String, Double>> results = runner.runApplicationsMedian(benches);
Assert.assertFalse(results.isEmpty());
// Check that no counter is repeated twice.
Map<String, List<Triple<SyntheticBenchmark<?>, String, Double>>> groups =
results.stream().collect(Collectors.groupingBy(x -> x.component2()));
Assert.assertFalse(groups.isEmpty());
for (String counter : groups.keySet()) {
List<?> matches = groups.get(counter);
Assert.assertTrue(matches.size() == 1);
}
}
@Test
public void testRunManyBenchmarks() {
// We want to test our setup can handle many benchmarks without crashing.
......
Supports Markdown
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