Commit 9d1cd967 authored by Noric Couderc's avatar Noric Couderc
Browse files

Implemented gathering of HW perf counters based on JMH benchmark data

The Applications are re-generated and ran again, to obtain the feature data.
parent 023d8f22
......@@ -207,8 +207,39 @@ open class PapiRunner(counters: CounterSpecification) {
return "$headerText\n$valuesText"
}
fun processJMHData(jmhData : MutableList<MutableList<String>>): MutableList<PapiRunner.FeatureVector> {
return listOf<FeatureVector>().toMutableList()
fun processJMHData(numRuns: Int, jmhData : MutableList<JMHProcessor.JMHRecord>): List<FeatureVector> {
val applications = jmhData.map { processJMHRecord(it)!! }
val results = runApplications(numRuns, applications)
return results.map {
val aggregates = it.value.mapValues { medianLong(it.value) }
val app = it.key
FeatureVector(app.seedString, app.dataStructureName, app.dataStructureName, aggregates)
}
}
fun getClassFromSimpleName(name : String) : Any {
val className = "java.util.$name"
return Class.forName(className).getConstructor().newInstance()
}
fun processJMHRecord(record : JMHProcessor.JMHRecord) : Application<*>? {
var application : Application<*>? = null
val dataStructure = getClassFromSimpleName(record.best)
if (record.collection == "List") {
application = ListApplication(record.seed, record.size, dataStructure as MutableList<Int>?)
return application
}
if (record.collection == "Map") {
application = MapApplication(record.seed, record.size, dataStructure as MutableMap<Int, Int>?)
return application
}
if (record.collection == "Set") {
application = SetApplication(record.seed, record.size, dataStructure as MutableSet<Int>?)
return application
}
return null
}
}
......
......@@ -140,9 +140,10 @@ public class PapiRunnerTest {
String data = JMHProcessorTest.Companion.generateData();
List<JMHProcessor.JMHRecord> processed = processor.process(new StringReader(data));
List<PapiRunner.FeatureVector> result = runner.processJMHData(processed);
List<PapiRunner.FeatureVector> result = runner.processJMHData(10, processed);
Assert.assertFalse(result.isEmpty());
Assert.assertFalse(result.stream().allMatch(it -> it.getCounters().isEmpty()));
}
}
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