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

Added test to test running a PAPI run on JMH data

Added a stub for method processJMHData which generates applications based on the
data and runs them
parent 8df64d39
......@@ -67,4 +67,28 @@ class JMHProcessor {
}
writer.close()
}
companion object {
/**
* Static method giving the expected CSV header
* @return A string for the expected CSV header
*/
fun getExpectedHeader() : String {
val header =
listOf(
"Benchmark",
"Mode",
"Threads",
"Samples",
"Score",
"Score Error (99.9%)",
"Unit",
"Param: applicationSize",
"Param: baseStructureSize",
"Param: datastructureName",
"Param: seed"
).map { "\"$it\""}.joinToString(",")
return header
}
}
}
......@@ -222,6 +222,10 @@ open class PapiRunner(counters: CounterSpecification) {
val valuesText = valuesTexts.joinToString("\n")
return "$headerText\n$valuesText"
}
fun processJMHData(jmhData : MutableList<MutableList<String>>): MutableList<PapiRunner.FeatureVector> {
return listOf<FeatureVector>().toMutableList()
}
}
fun main(args: Array<String>) {
......
......@@ -4,13 +4,11 @@ import org.junit.Test;
import papi.EventSet;
import papi.Papi;
import papi.PapiException;
import se.lth.cs.Application;
import se.lth.cs.*;
import se.lth.cs.ApplicationGeneration.ListApplicationGenerator;
import se.lth.cs.CounterSpecification;
import se.lth.cs.PapiRunner;
import se.lth.cs.PapiRunnerKt;
import java.io.File;
import java.io.StringReader;
import java.lang.reflect.InvocationTargetException;
import java.util.*;
import java.util.function.IntPredicate;
......@@ -133,4 +131,18 @@ public class PapiRunnerTest {
runner.featuresToCSV(data));
}
/**
* Runs a test from JMH-processed data
*/
@Test
public void TestJMHRunner() {
JMHProcessor processor = new JMHProcessor();
String data = JMHProcessorTest.Companion.generateData();
List<List<String>> processed = processor.process(new StringReader(data));
List<PapiRunner.FeatureVector> result = runner.processJMHData(processed);
Assert.assertFalse(result.isEmpty());
}
}
......@@ -216,4 +216,45 @@ class JMHProcessorTest {
Assert.assertTrue(interfaces.any { record.get("Best").contains(it) })
}
}
companion object {
/**
* Static method to generate some example data
*/
fun generateData() : String {
var data = mutableListOf<String>()
var row1 =
listOf(
"\"se.lth.cs.jmh.ListApplicationBenchmark.ListApplicationBenchmark\"",
"\"thrpt\"",
1,
10,
185.524701,
29.416447,
"ops/s",
10,
0,
"LinkedList",
0
).joinToString(",")
var row2 =
listOf(
"\"se.lth.cs.jmh.ListApplicationBenchmark.ListApplicationBenchmark\"",
"\"thrpt\"",
1,
10,
414.886418,
200.555845,
"ops/s",
10,
0,
"ArrayList",
0
).joinToString(",")
data.add(row1)
data.add(row2)
val text = "${JMHProcessor.getExpectedHeader()}\n${data.joinToString("\n")}"
return text
}
}
}
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