Gitlab service upgraded. Please report any problems to dl_gitadmin@cs.lth.se

Commit eedc60df authored by Noric Couderc's avatar Noric Couderc

Enabled resetting the app between PAPI runs

Should fix a bug where all values for all PAPI runs ended up being the same.
parent 7f434e7f
......@@ -159,6 +159,7 @@ public abstract class Application<T> {
*/
public void reset(int baseNumberElements) {
randomGenerator = new Random(seed);
currentMethodIndex = 0;
clearDataStructure();
populate(baseNumberElements);
}
......
......@@ -138,9 +138,9 @@ open class PapiRunner(counters: CounterSpecification) {
val writer = FileWriter("/dev/null")
var values = mutableListOf<Long>()
app.populate(app.getBaseDataStructureSize())
for (run in 0 until numRuns) {
// We do the measurements
app.reset(app.baseDataStructureSize)
var accumulator = 0
evset.start()
while (app.hasNext()) {
......
......@@ -148,6 +148,29 @@ public class PapiRunnerTest {
Assert.assertFalse(result.stream().allMatch(it -> it.getCounters().isEmpty()));
}
/**
* Runs a test for a bug where all values of a generated run where the same for all rows.
*/
@Test
public void TestRunApplicationsDifferent() {
JMHProcessor processor = new JMHProcessor();
String data = JMHProcessorTest.Companion.generateData();
List<JMHProcessor.JMHRecord> processed = processor.process(new StringReader(data));
List<PapiRunner.FeatureVector> result = runner.processJMHData(10, processed);
List<Double> column = result.stream().map((row) -> row.getCounters().get("PAPI_BR_NTK"))
.collect(Collectors.toList());
// Check the data is correct
Assert.assertTrue(column.stream().noneMatch(Objects::isNull));
Assert.assertFalse(column.stream().allMatch(x -> x == column.get(0)));
// Check the csv is correct
String csv = runner.featuresToCSV(result);
return;
}
@Test
public void TestRunApplications() {
SetApplication setsmall = new SetApplication(0, 100, 0, new HashSet<>());
......
Markdown is supported
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