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

Added methods for building benchmarks with time() seed

Added functions to build BCBenchmarkPackages with a seed assigned to
time(), for sets and maps.
parent af24a7b7
......@@ -379,7 +379,7 @@ public class BCBenchmarkPackage<T> implements Serializable {
}
public static BCBenchmarkPackage<List<Object>>
LIST(int seed, int trace_size, int datastructure_size, MethodSelectionType mst, java.util.List<?> target) {
LIST(long seed, int trace_size, int datastructure_size, MethodSelectionType mst, java.util.List<?> target) {
return new BCBenchmarkPackage<List<Object>>(seed, trace_size, datastructure_size, (java.util.List<Object>)target,
mst,
BCGenLIST);
......@@ -403,12 +403,17 @@ public class BCBenchmarkPackage<T> implements Serializable {
@Deprecated
public static BCBenchmarkPackage<Set<Object>>
SET(int seed, int trace_size, int datastructure_size, java.util.Set<?> target) {
SET(long seed, int trace_size, int datastructure_size, java.util.Set<?> target) {
return SET(seed, trace_size, datastructure_size, POLYA, target);
}
public static BCBenchmarkPackage<Set<Object>>
SET(int seed, int trace_size, int datastructure_size, MethodSelectionType mst, java.util.Set<?> target) {
SET(int trace_size, int datastructure_size, java.util.Set<?> target) {
return SET(getUnixTimeStamp(), trace_size, datastructure_size, POLYA, target);
}
public static BCBenchmarkPackage<Set<Object>>
SET(long seed, int trace_size, int datastructure_size, MethodSelectionType mst, java.util.Set<?> target) {
return new BCBenchmarkPackage<Set<Object>>(seed, trace_size, datastructure_size, (java.util.Set<Object>)target,
mst,
BCGenSET);
......@@ -425,12 +430,18 @@ public class BCBenchmarkPackage<T> implements Serializable {
@Deprecated
public static BCBenchmarkPackage<Map<Object, Object>>
MAP(int seed, int trace_size, int datastructure_size, java.util.Map<?,?> target) {
MAP(long seed, int trace_size, int datastructure_size, java.util.Map<?,?> target) {
return MAP(seed, trace_size, datastructure_size, POLYA, target);
}
public static BCBenchmarkPackage<Map<Object, Object>>
MAP(int seed, int trace_size, int datastructure_size, MethodSelectionType mst, java.util.Map<?,?> target) {
MAP(int trace_size, int datastructure_size, java.util.Map<?,?> target) {
return MAP(getUnixTimeStamp(), trace_size, datastructure_size, POLYA, target);
}
public static BCBenchmarkPackage<Map<Object, Object>>
MAP(long seed, int trace_size, int datastructure_size, MethodSelectionType mst, java.util.Map<?,?> target) {
return new BCBenchmarkPackage<Map<Object, Object>>(seed, trace_size, datastructure_size, (java.util.Map<Object, Object>)target,
mst,
BCGenMAP);
......
......@@ -20,7 +20,7 @@ class JMHProcessor {
return process(FileReader(file))
}
data class JMHRecord(val seed : Int,
data class JMHRecord(val seed : Long,
val size : Int,
val baseStructureSize : Int,
val collection : String,
......@@ -88,7 +88,7 @@ class JMHProcessor {
return seedsToRecords.values.flatMap { records ->
val interfaceName = records[0].get("Benchmark").let { processBenchmarkName(it) }
val seed = records[0].get("Param: seed")
.let { it.toInt()}
.let { it.toLong()}
val size = records[0].get("Param: applicationSize")
.let { Integer.parseInt(it)}
val baseStructureSize = records[0].get("Param: baseStructureSize")
......
......@@ -11,10 +11,7 @@ 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 se.lth.cs.bcgen.BenchmarkGenerator;
import se.lth.cs.bcgen.MethodSelectionStrategyLoader;
import se.lth.cs.bcgen.MethodSelectionType;
import se.lth.cs.bcgen.*;
import java.lang.reflect.InvocationTargetException;
import java.nio.file.Paths;
......@@ -650,10 +647,14 @@ public class SyntheticBenchmarkTest {
int size = 100;
long minSeed = System.currentTimeMillis() / 1000L;
BCBenchmarkPackage<List<Object>> bench = BCBenchmarkPackage.LIST(size, 0, new ArrayList());
BCBenchmarkPackage<Map<Object, Object>> benchM = BCBenchmarkPackage.MAP(size, 0, new HashMap());
BCBenchmarkPackage<Set<Object>> benchS = BCBenchmarkPackage.SET(size, 0, new HashSet());
long maxSeed = System.currentTimeMillis() / 1000L;
Assertions.assertTrue(minSeed <= bench.getSeed());
Assertions.assertTrue(bench.getSeed() <= maxSeed);
for (BCBenchmarkPackage<?> b : Arrays.asList(bench, benchM, benchS)) {
Assertions.assertTrue(minSeed <= b.getSeed());
Assertions.assertTrue(b.getSeed() <= maxSeed);
}
}
}
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