summaryrefslogtreecommitdiff
path: root/simulator/opendc-simulator
diff options
context:
space:
mode:
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()