summaryrefslogtreecommitdiff
path: root/simulator/opendc-simulator
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2021-04-15 14:46:19 +0200
committerGitHub <noreply@github.com>2021-04-15 14:46:19 +0200
commitf586769b37994628fbdc7ab0756b1b96650fca10 (patch)
treea5c74ae02a812e050f4feec778f274705ce66076 /simulator/opendc-simulator
parent890dd87376f0d131292e3cdc685ab13192d11634 (diff)
parente68046465d39611259fa13952add731e80ea7331 (diff)
Fix issues with web runner (v2) (#118)
This is a second pull request to address several issues that were present in the web runner and the associated experiments: * Re-use topology across repeats * Disallow re-use of `SimTraceWorkload` * Construct new `SimTraceWorkload` for each simulation run
Diffstat (limited to 'simulator/opendc-simulator')
-rw-r--r--simulator/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/workload/SimTraceWorkload.kt4
1 files changed, 3 insertions, 1 deletions
diff --git a/simulator/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/workload/SimTraceWorkload.kt b/simulator/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/workload/SimTraceWorkload.kt
index 694a928b..ffb332d1 100644
--- a/simulator/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/workload/SimTraceWorkload.kt
+++ b/simulator/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/workload/SimTraceWorkload.kt
@@ -34,12 +34,14 @@ import org.opendc.simulator.resources.consumer.SimConsumerBarrier
* consumption for some period of time.
*/
public class SimTraceWorkload(public val trace: Sequence<Fragment>) : SimWorkload {
- private var offset = 0L
+ private var offset = Long.MIN_VALUE
private val iterator = trace.iterator()
private var fragment: Fragment? = null
private lateinit var barrier: SimConsumerBarrier
override fun onStart(ctx: SimMachineContext) {
+ check(offset == Long.MIN_VALUE) { "Workload does not support re-use" }
+
barrier = SimConsumerBarrier(ctx.cpus.size)
fragment = nextFragment()
offset = ctx.clock.millis()