Commit 50077e59 authored by Noric Couderc's avatar Noric Couderc
Browse files

Refactoring: A RunSpec now carries a list of features

We used PAPI counters before, and it's true these are the most relevant,
but it makes sense to make this more general.
parent 9fac70ae
......@@ -3,10 +3,11 @@ package se.lth.cs.papicounters
import papi.EventSet
import se.lth.cs.bcgen.BCBenchmarkPackage
import se.lth.cs.timing.OperationType
import se.lth.cs.util.Feature
interface PapiBenchmarkAnalyzer {
class RunSpec(val numRuns: Int,
val counters : List<PAPICounter>,
val features : List<Feature>,
val eventSet: EventSet,
val syntheticBenchmark: BCBenchmarkPackage<*>) {
......@@ -15,7 +16,11 @@ interface PapiBenchmarkAnalyzer {
for that, the counters have to be 2 counters + (optionally) PAPI_TOT_CYC and PAPI_TOT_INS
*/
fun canBeSampled(): Boolean {
return counters.filter { ! it.isSpecial() }.size <= 2
return counters().filter { ! it.isSpecial() }.size <= 2
}
fun counters() : List<PAPICounter> {
return features.filterIsInstance<PAPICounter>()
}
}
......
......@@ -89,7 +89,7 @@ open class PapiRunner(val numRuns: Int, val counters: List<PAPICounter>) : PapiB
writer.write(accumulator)
writer.write(resultDataStructure.toString())
// We record the data
val runSamples = spec.counters.zip(evset.counters.toList()).map {
val runSamples = spec.counters().zip(evset.counters.toList()).map {
PapiBenchmarkAnalyzer.BenchmarkRunSample(it.first, it.second.toDouble())
}
val runData = PapiBenchmarkAnalyzer.BenchmarkRunData(
......@@ -205,7 +205,7 @@ class MockupPapiRunner(numRuns : Int, counters : List<PAPICounter>) : PapiRunner
// val n = seed + counterToInt[spec.counter]!!
val iterations = 0 until spec.numRuns
return iterations.map {
val samples = spec.counters.map {
val samples = spec.counters().map {
PapiBenchmarkAnalyzer.BenchmarkRunSample(it, 10000.0)
}
......
......@@ -98,7 +98,7 @@ class PapiTracerRunner(numRuns : Int, counters : List<PAPICounter>) : PapiRunner
}
fun runIterations(spec : PapiBenchmarkAnalyzer.RunSpec) : List<List<TraceRecord>> {
val counters = spec.counters
val counters = spec.counters()
.filter { ! it.isSpecial() } // These are active by default.
.map { it.toPAPIConstant()!! }
......@@ -147,7 +147,7 @@ class PapiTracerRunner(numRuns : Int, counters : List<PAPICounter>) : PapiRunner
// Analyze text for this iteration
val g = analyzeOutput(it)
// Get features present in this iteration.
val counterSamples = spec.counters.map { counter ->
val counterSamples = spec.counters().map { counter ->
val featureNumber = counter.toHexa()
val allocationSites = g.predecessors(featureNumber)
......
......@@ -170,7 +170,7 @@ public class PapiRunnerTest {
for (PapiBenchmarkAnalyzer.RunSpec r : specs) {
Assertions.assertEquals(
runner.getCounters(),
r.getCounters()
r.counters()
);
Assertions.assertTrue(r.canBeSampled());
......
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