summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/TestExperiment.kt8
-rw-r--r--opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/sc20/Sc20TraceReader.kt7
2 files changed, 10 insertions, 5 deletions
diff --git a/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/TestExperiment.kt b/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/TestExperiment.kt
index 3aef80e6..79e749b5 100644
--- a/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/TestExperiment.kt
+++ b/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/TestExperiment.kt
@@ -76,6 +76,8 @@ class ExperimentParameters(parser: ArgParser) {
parseVMs(FileReader(File(this)).readText())
}
.default { emptyList() }
+ val seed by parser.storing("the random seed") { toInt() }
+ .default(0)
val failures by parser.flagging("-x", "--failures", help = "enable (correlated) machine failures")
val allocationPolicy by parser.storing("name of VM allocation policy to use").default("core-mem")
@@ -134,7 +136,7 @@ fun main(args: Array<String>) {
"active-servers-inv" to NumberOfActiveServersAllocationPolicy(true),
"provisioned-cores" to ProvisionedCoresAllocationPolicy(),
"provisioned-cores-inv" to ProvisionedCoresAllocationPolicy(true),
- "random" to RandomAllocationPolicy()
+ "random" to RandomAllocationPolicy(Random(seed))
)
if (allocationPolicy !in allocationPolicies) {
@@ -215,7 +217,7 @@ fun main(args: Array<String>) {
val domain = root.newDomain(name = "failures")
domain.launch {
chan.receive()
- val random = Random(0)
+ val random = Random(seed)
val injectors = mutableMapOf<String, FaultInjector>()
for (node in bareMetalProvisioner.nodes()) {
val cluster = node.metadata[NODE_CLUSTER] as String
@@ -231,7 +233,7 @@ fun main(args: Array<String>) {
var submitted = 0L
val finish = Channel<Unit>(Channel.RENDEZVOUS)
- val reader = Sc20TraceReader(File(traceDirectory), performanceInterferenceModel, getSelectedVmList())
+ val reader = Sc20TraceReader(File(traceDirectory), performanceInterferenceModel, getSelectedVmList(), Random(seed))
while (reader.hasNext()) {
val (time, workload) = reader.next()
submitted++
diff --git a/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/sc20/Sc20TraceReader.kt b/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/sc20/Sc20TraceReader.kt
index d4eef029..da678c07 100644
--- a/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/sc20/Sc20TraceReader.kt
+++ b/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/sc20/Sc20TraceReader.kt
@@ -38,6 +38,7 @@ import java.io.FileReader
import java.util.UUID
import kotlin.math.max
import kotlin.math.min
+import kotlin.random.Random
/**
* A [TraceReader] for the internal VM workload trace format.
@@ -48,7 +49,8 @@ import kotlin.math.min
class Sc20TraceReader(
traceDirectory: File,
performanceInterferenceModel: PerformanceInterferenceModel,
- selectedVms: List<String>
+ selectedVms: List<String>,
+ random: Random
) : TraceReader<VmWorkload> {
/**
* The internal iterator to use for this reader.
@@ -161,7 +163,8 @@ class Sc20TraceReader(
val relevantPerformanceInterferenceModelItems =
PerformanceInterferenceModel(
- performanceInterferenceModel.items.filter { it.workloadNames.contains(vmId) }.toSet()
+ performanceInterferenceModel.items.filter { it.workloadNames.contains(vmId) }.toSet(),
+ Random(random.nextInt())
)
val vmWorkload = VmWorkload(
uuid, "VM Workload $vmId", UnnamedUser,