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

Fixed bug with loading JMH data

When JMH data was loaded, the same generation scheme was used for all
the benchmarks that shared seed, size, data-structure, and base
structure size, while they shouldn't.
parent 39fa5ea7
......@@ -94,17 +94,15 @@ class JMHProcessor {
val baseStructureSize = records[0].get("Param: baseStructureSize")
.let { Integer.parseInt(it)}
val methodSelection =
if (records[0].isSet("Param: methodSelectionStrategyId")) {
records[0].get("Param: methodSelectionStrategyId")
} else {
null
}
val best = getBestDataStructure(records)
records.map{
val methodSelection =
if (it.isSet("Param: methodSelectionStrategyId")) {
it.get("Param: methodSelectionStrategyId")
} else {
null
}
JMHRecord(seed, size, baseStructureSize,
interfaceName, it.get("Param: datastructureName"), best!!,
methodSelection)
......
......@@ -427,6 +427,41 @@ class JMHProcessorTest {
Assertions.assertEquals(benchmarkNull!!.trace, benchmarkPolya.trace)
}
@Test
fun testBenchmarkIDConsistency() {
MethodSelectionStrategyLoader.jbrainyPath = Paths.get("..").toAbsolutePath()
val jmhRecord = JMHProcessor.JMHRecord(0, 100, 0, "List",
"ArrayList", "ArrayList", "MARKOV");
val benchmark = jmhRecord.generateSyntheticBenchmark();
Assertions.assertEquals( "Synth:MARKOV:0:100:List:0:ArrayList", benchmark!!.benchmarkIdentifier)
}
@Test
fun testJMHLoadingWithMethodSelectionStrategy() {
val text = """
"Benchmark","Mode","Threads","Samples","Score","Score Error (99.9%)","Unit","Param: applicationSize","Param: baseStructureSize","Param: datastructureName","Param: methodSelectionStrategyId","Param: seed"
"se.lth.cs.jmh.ListApplicationBenchmark.ListApplicationBenchmark","thrpt",1,4,4.568795,4.389897,"ops/ms",100,0,LinkedList,UNIFORM,1
"se.lth.cs.jmh.ListApplicationBenchmark.ListApplicationBenchmark","thrpt",1,4,2.626655,0.987582,"ops/ms",100,0,LinkedList,POLYA,1
"se.lth.cs.jmh.ListApplicationBenchmark.ListApplicationBenchmark","thrpt",1,4,15.227197,5.624172,"ops/ms",100,0,LinkedList,MARKOV,1
""".trimIndent()
val results = processor!!.process(StringReader(text))
val expected = listOf<JMHProcessor.JMHRecord>(
JMHProcessor.JMHRecord(1, 100, 0,
"List", "LinkedList", "LinkedList", "UNIFORM"),
JMHProcessor.JMHRecord(1, 100, 0,
"List", "LinkedList", "LinkedList", "POLYA"),
JMHProcessor.JMHRecord(1, 100, 0,
"List", "LinkedList", "LinkedList", "MARKOV")
)
Assertions.assertEquals(expected, results)
}
companion object {
/**
* Static method to generate some example data
......
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