summaryrefslogtreecommitdiff
path: root/opendc-experiments
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2022-10-28 16:46:47 +0200
committerGitHub <noreply@github.com>2022-10-28 16:46:47 +0200
commitb96acc687f59b698fbc4d4c984d77b008cd4051b (patch)
treeff4d99454259b92ec4484433bb716acd6319faa1 /opendc-experiments
parentc4cfb6f6e0507f335fd88935857f20e88c34abd0 (diff)
parent8bf940eb7b59b5e5e326cfc06d51bdb54393f33b (diff)
Support custom start-up and clean-up time for VMs (#112)
This pull request implements customizable startup and clean-up time for virtual machine. We achieve this by implementing `SimWorkload` chaining and modelling start-up and clean-up time using `SimWorkload` as well. Implements #33 ## Implementation Notes :hammer_and_pick: * Store method parameters in class files * Add completion parameter to startWorkload * Provide workload constructors in SimWorkloads * Add support for resetting machine context * Add support for chaining workloads * Use workload chaining for boot delay * Model host boot time * Do not suspend on guest start * Use static logger field ## Breaking API Changes :warning: * `SimMachine#startWorkload` now has a third parameter `completion` which is invoked when the workload finishes executing (either due to failure or success). * `SimFlopsWorkload` and `SimRuntimeWorkload` can be instantiated via `SimWorkloads`.
Diffstat (limited to 'opendc-experiments')
-rw-r--r--opendc-experiments/opendc-experiments-capelin/src/test/kotlin/org/opendc/experiments/capelin/CapelinIntegrationTest.kt22
-rw-r--r--opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/HostsProvisioningStep.kt3
-rw-r--r--opendc-experiments/opendc-experiments-workflow/src/main/kotlin/org/opendc/experiments/workflow/TraceHelpers.kt4
3 files changed, 14 insertions, 15 deletions
diff --git a/opendc-experiments/opendc-experiments-capelin/src/test/kotlin/org/opendc/experiments/capelin/CapelinIntegrationTest.kt b/opendc-experiments/opendc-experiments-capelin/src/test/kotlin/org/opendc/experiments/capelin/CapelinIntegrationTest.kt
index 47058caa..77b0d09f 100644
--- a/opendc-experiments/opendc-experiments-capelin/src/test/kotlin/org/opendc/experiments/capelin/CapelinIntegrationTest.kt
+++ b/opendc-experiments/opendc-experiments-capelin/src/test/kotlin/org/opendc/experiments/capelin/CapelinIntegrationTest.kt
@@ -120,9 +120,9 @@ class CapelinIntegrationTest {
{ assertEquals(0, monitor.serversActive, "All VMs should finish after a run") },
{ assertEquals(0, monitor.attemptsFailure, "No VM should be unscheduled") },
{ assertEquals(0, monitor.serversPending, "No VM should not be in the queue") },
- { assertEquals(223394204, monitor.idleTime) { "Incorrect idle time" } },
- { assertEquals(66976984, monitor.activeTime) { "Incorrect active time" } },
- { assertEquals(3160316, monitor.stealTime) { "Incorrect steal time" } },
+ { assertEquals(223394101, monitor.idleTime) { "Incorrect idle time" } },
+ { assertEquals(66977086, monitor.activeTime) { "Incorrect active time" } },
+ { assertEquals(3160276, monitor.stealTime) { "Incorrect steal time" } },
{ assertEquals(0, monitor.lostTime) { "Incorrect lost time" } },
{ assertEquals(5.84093E9, monitor.energyUsage, 1E4) { "Incorrect power draw" } }
)
@@ -160,8 +160,8 @@ class CapelinIntegrationTest {
// Note that these values have been verified beforehand
assertAll(
- { assertEquals(10999504, monitor.idleTime) { "Idle time incorrect" } },
- { assertEquals(9741294, monitor.activeTime) { "Active time incorrect" } },
+ { assertEquals(10999514, monitor.idleTime) { "Idle time incorrect" } },
+ { assertEquals(9741285, monitor.activeTime) { "Active time incorrect" } },
{ assertEquals(0, monitor.stealTime) { "Steal time incorrect" } },
{ assertEquals(0, monitor.lostTime) { "Lost time incorrect" } },
{ assertEquals(7.0116E8, monitor.energyUsage, 1E4) { "Incorrect power draw" } }
@@ -199,10 +199,10 @@ class CapelinIntegrationTest {
// Note that these values have been verified beforehand
assertAll(
- { assertEquals(6027979, monitor.idleTime) { "Idle time incorrect" } },
- { assertEquals(14712820, monitor.activeTime) { "Active time incorrect" } },
- { assertEquals(12532979, monitor.stealTime) { "Steal time incorrect" } },
- { assertEquals(445913, monitor.lostTime) { "Lost time incorrect" } }
+ { assertEquals(6028018, monitor.idleTime) { "Idle time incorrect" } },
+ { assertEquals(14712781, monitor.activeTime) { "Active time incorrect" } },
+ { assertEquals(12532934, monitor.stealTime) { "Steal time incorrect" } },
+ { assertEquals(424267, monitor.lostTime) { "Lost time incorrect" } }
)
}
@@ -229,8 +229,8 @@ class CapelinIntegrationTest {
// Note that these values have been verified beforehand
assertAll(
- { assertEquals(10085103, monitor.idleTime) { "Idle time incorrect" } },
- { assertEquals(8539212, monitor.activeTime) { "Active time incorrect" } },
+ { assertEquals(10085111, monitor.idleTime) { "Idle time incorrect" } },
+ { assertEquals(8539204, monitor.activeTime) { "Active time incorrect" } },
{ assertEquals(0, monitor.stealTime) { "Steal time incorrect" } },
{ assertEquals(0, monitor.lostTime) { "Lost time incorrect" } },
{ assertEquals(2328039558, monitor.uptime) { "Uptime incorrect" } }
diff --git a/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/HostsProvisioningStep.kt b/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/HostsProvisioningStep.kt
index 292be929..e224fb84 100644
--- a/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/HostsProvisioningStep.kt
+++ b/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/HostsProvisioningStep.kt
@@ -58,8 +58,7 @@ public class HostsProvisioningStep internal constructor(
spec.uid,
spec.name,
spec.meta,
- ctx.coroutineContext,
- graph,
+ ctx.clock,
machine,
hypervisor,
optimize = optimize
diff --git a/opendc-experiments/opendc-experiments-workflow/src/main/kotlin/org/opendc/experiments/workflow/TraceHelpers.kt b/opendc-experiments/opendc-experiments-workflow/src/main/kotlin/org/opendc/experiments/workflow/TraceHelpers.kt
index 4dc3a775..b622362a 100644
--- a/opendc-experiments/opendc-experiments-workflow/src/main/kotlin/org/opendc/experiments/workflow/TraceHelpers.kt
+++ b/opendc-experiments/opendc-experiments-workflow/src/main/kotlin/org/opendc/experiments/workflow/TraceHelpers.kt
@@ -27,7 +27,7 @@ package org.opendc.experiments.workflow
import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
-import org.opendc.simulator.compute.workload.SimFlopsWorkload
+import org.opendc.simulator.compute.workload.SimWorkloads
import org.opendc.trace.Trace
import org.opendc.trace.conv.TABLE_TASKS
import org.opendc.trace.conv.TASK_ALLOC_NCPUS
@@ -74,7 +74,7 @@ public fun Trace.toJobs(): List<Job> {
val submitTime = reader.getInstant(TASK_SUBMIT_TIME)!!
val runtime = reader.getDuration(TASK_RUNTIME)!!
val flops: Long = 4000 * runtime.seconds * grantedCpus
- val workload = SimFlopsWorkload(flops, 1.0)
+ val workload = SimWorkloads.flops(flops, 1.0)
val task = Task(
UUID(0L, id),
"<unnamed>",