Commit a3647ead authored by Noric Couderc's avatar Noric Couderc

Formatting

parent 52766045
......@@ -5,9 +5,12 @@ import papi.Constants;
import papi.EventSet;
import papi.Papi;
import papi.PapiException;
import se.lth.cs.*;
import se.lth.cs.bcgen.*;
import se.lth.cs.SyntheticBenchmarkGeneration.*;
import se.lth.cs.SyntheticBenchmarkGeneration.ListSyntheticBenchmarkGenerator;
import se.lth.cs.SyntheticBenchmarkGeneration.MapSyntheticBenchmarkGenerator;
import se.lth.cs.SyntheticBenchmarkGeneration.SetSyntheticBenchmarkGenerator;
import se.lth.cs.SyntheticBenchmarkRunner;
import se.lth.cs.TrainingSetValue;
import se.lth.cs.bcgen.BCBenchmarkPackage;
import java.lang.reflect.InvocationTargetException;
import java.util.*;
......@@ -25,7 +28,7 @@ public class SyntheticBenchmarkTest {
BCBenchmarkPackage<List<Object>> arrayListBench = BCBenchmarkPackage.LIST(
0,
100,
0,
0,
new ArrayList<>()
);
Assert.assertEquals(100, arrayListBench.getTrace().size());
......@@ -33,16 +36,16 @@ public class SyntheticBenchmarkTest {
@Test
public void TestLongBenchmark() {
// test that we can generate large classes with more than 65535 bytecodes in a method
// test that we can generate large classes with more than 65535 bytecodes in a method
BCBenchmarkPackage<List<Object>> arrayListBench = BCBenchmarkPackage.LIST(
0,
110000,
0,
0,
new ArrayList<>()
);
arrayListBench.reset();
arrayListBench.runBenchmark(blackhole); // no failure permitted
Assert.assertEquals(arrayListBench.getDatastructure(), arrayListBench.getBenchmarkInfo().getSimulationState());
arrayListBench.reset();
arrayListBench.runBenchmark(blackhole); // no failure permitted
Assert.assertEquals(arrayListBench.getDatastructure(), arrayListBench.getBenchmarkInfo().getSimulationState());
}
@Test
......@@ -52,23 +55,23 @@ public class SyntheticBenchmarkTest {
BCBenchmarkPackage<List<Object>> arrayListBench = BCBenchmarkPackage.LIST(
seed,
100,
0,
0,
new ArrayList<>());
BCBenchmarkPackage<List<Object>> linkedListBench = BCBenchmarkPackage.LIST(
seed,
100,
0,
0,
new LinkedList<>()
);
BCBenchmarkPackage<List<Object>> vectorBench = BCBenchmarkPackage.LIST(
seed,
100,
0,
0,
new Vector<>()
);
arrayListBench.reset();
linkedListBench.reset();
vectorBench.reset();
arrayListBench.reset();
linkedListBench.reset();
vectorBench.reset();
benchmarkApplication(arrayListBench);
benchmarkApplication(linkedListBench);
benchmarkApplication(vectorBench);
......@@ -89,7 +92,8 @@ public class SyntheticBenchmarkTest {
@Test
public void TestListApplication1() throws InvocationTargetException, IllegalAccessException {
SyntheticBenchmarkRunner runner = new SyntheticBenchmarkRunner();
List<TrainingSetValue> v = runner.runBenchmarks(new ListSyntheticBenchmarkGenerator().createApplications(0, 100, 10));
List<TrainingSetValue> v = runner.runBenchmarks(
new ListSyntheticBenchmarkGenerator().createApplications(0, 100, 10));
return;
}
......@@ -101,8 +105,8 @@ public class SyntheticBenchmarkTest {
BCBenchmarkPackage<Set<Object>> treeSetBench = BCBenchmarkPackage.SET(seed, 10, 0, new TreeSet<>());
hashSetBench.reset();
treeSetBench.reset();
hashSetBench.reset();
treeSetBench.reset();
benchmarkApplication(hashSetBench);
benchmarkApplication(treeSetBench);
......@@ -130,9 +134,9 @@ public class SyntheticBenchmarkTest {
BCBenchmarkPackage<Map<Object, Object>> hashTableBench = BCBenchmarkPackage.MAP(seed, 10, 0, new Hashtable<>());
BCBenchmarkPackage<Map<Object, Object>> treeMapBench = BCBenchmarkPackage.MAP(seed, 10, 0, new TreeMap<>());
hashMapBench.reset();
hashTableBench.reset();
treeMapBench.reset();
hashMapBench.reset();
hashTableBench.reset();
treeMapBench.reset();
benchmarkApplication(hashMapBench);
benchmarkApplication(hashTableBench);
......@@ -174,7 +178,7 @@ public class SyntheticBenchmarkTest {
// Running the benchmark and measuring time
for (BCBenchmarkPackage<List<Object>> app : applications) {
app.reset();
app.reset();
long startTime = System.nanoTime();
benchmarkApplication(app);
long endTime = System.nanoTime();
......@@ -392,13 +396,13 @@ public class SyntheticBenchmarkTest {
public void testGetPlanIdentifier() {
BCBenchmarkPackage<List<Object>> listBench = BCBenchmarkPackage.LIST(
102, 100, 10, new ArrayList<>());
BCBenchmarkPackage<Set<Object>> setBench = BCBenchmarkPackage.SET(
102, 100, 10, new HashSet<>());
BCBenchmarkPackage<Set<Object>> setBench = BCBenchmarkPackage.SET(
102, 100, 10, new HashSet<>());
BCBenchmarkPackage<Map<Object, Object>> mapBench = BCBenchmarkPackage.MAP(
102, 100, 10, new HashMap<>());
String expected = "Synth:102:100:List";
Assert.assertEquals(expected, listBench.getPlanIdentifier());
String expected = "Synth:102:100:List";
Assert.assertEquals(expected, listBench.getPlanIdentifier());
expected = "Synth:102:100:Set";
Assert.assertEquals(expected, setBench.getPlanIdentifier());
expected = "Synth:102:100:Map";
......@@ -424,26 +428,26 @@ public class SyntheticBenchmarkTest {
@Test
public void testGetSizeBenchmarkFromTrace() {
List<String> trace = Arrays.asList(
"runAdd",
"runAdd",
"runGet"
List<String> trace = Arrays.asList(
"runAdd",
"runAdd",
"runGet"
);
BCBenchmarkPackage<List<Object>> bench = BCBenchmarkPackage.LIST("TestBenchmark", trace, new ArrayList<>());
BCBenchmarkPackage<List<Object>> bench = BCBenchmarkPackage.LIST("TestBenchmark", trace, new ArrayList<>());
Assert.assertEquals(
trace.size(),
bench.getTraceSize()
Assert.assertEquals(
trace.size(),
bench.getTraceSize()
);
}
@Test
public void testNormalizedHistogram() {
List<String> trace = Arrays.asList(
"runAdd",
"runAdd",
"runGet"
List<String> trace = Arrays.asList(
"runAdd",
"runAdd",
"runGet"
);
BCBenchmarkPackage<List<Object>> bench = BCBenchmarkPackage.LIST("TestBenchmark", trace, new ArrayList<>());
......
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