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

Added a function runWithoutInterleaving2 that works

Used to fix a bug in runWithoutInterleaving which makes it crash after a couple
of iterations (too many calls to Evenset.create).
parent 4f83d323
......@@ -161,6 +161,47 @@ class PapiRunner() {
return data
}
/** Runs a set of programs (functions) without interleaving
* (Performance should get better if there is JIT compilation)
* @Returns A map from couples (counter, program-name) -> values over all runs
*/
inline fun runWithoutInterleaving2(numRuns : Int, functions : List<Pair<String,() -> Any>>):
SortedMap<String, List<Long>> {
Papi.init()
var data : SortedMap<String, List<Long>> = sortedMapOf()
// For each counter that is available
for (kvp in counterSpec) {
println("Streamlined mode: " + "'" + kvp.key + "'")
// We record only one counter
val evset = EventSet.create(kvp.value)
// For each program...
for (function in functions) {
val current = Pair(kvp.key, function.first)
// We run it n times
var values = mutableListOf<Long>()
for (run in 0..numRuns) {
// We do the measurements
evset.start()
val result = function.second()
evset.stop()
//println(result)
// We record the data
val data = evset.counters
values.addAll(data.toList())
}
val label = current.first + ":" + current.second
data[label] = values
}
}
return data
}
/**
* Runs a function several times
* @return A map from PAPI counter names to list of values
......
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