summaryrefslogtreecommitdiff
path: root/opendc-experiments
diff options
context:
space:
mode:
Diffstat (limited to 'opendc-experiments')
-rw-r--r--opendc-experiments/opendc-experiments-tf20/src/main/kotlin/org/opendc/experiments/tf20/core/SimTFDevice.kt11
1 files changed, 7 insertions, 4 deletions
diff --git a/opendc-experiments/opendc-experiments-tf20/src/main/kotlin/org/opendc/experiments/tf20/core/SimTFDevice.kt b/opendc-experiments/opendc-experiments-tf20/src/main/kotlin/org/opendc/experiments/tf20/core/SimTFDevice.kt
index bfc5fc6f..1fbd3b6a 100644
--- a/opendc-experiments/opendc-experiments-tf20/src/main/kotlin/org/opendc/experiments/tf20/core/SimTFDevice.kt
+++ b/opendc-experiments/opendc-experiments-tf20/src/main/kotlin/org/opendc/experiments/tf20/core/SimTFDevice.kt
@@ -128,7 +128,7 @@ public class SimTFDevice(
}
}
- override fun onNext(ctx: SimResourceContext, now: Long, delta: Long): SimResourceCommand {
+ override fun onNext(ctx: SimResourceContext, now: Long, delta: Long): Long {
val consumedWork = ctx.speed * delta / 1000.0
val activeWork = activeWork
@@ -137,7 +137,8 @@ public class SimTFDevice(
this.activeWork = null
} else {
val duration = (activeWork.flops / ctx.capacity * 1000).roundToLong()
- return SimResourceCommand.Consume(ctx.capacity, duration)
+ ctx.push(ctx.capacity)
+ return duration
}
}
@@ -146,9 +147,11 @@ public class SimTFDevice(
return if (head != null) {
this.activeWork = head
val duration = (head.flops / ctx.capacity * 1000).roundToLong()
- SimResourceCommand.Consume(ctx.capacity, duration)
+ ctx.push(ctx.capacity)
+ duration
} else {
- SimResourceCommand.Consume(0.0)
+ ctx.push(0.0)
+ Long.MAX_VALUE
}
}