summaryrefslogtreecommitdiff
path: root/simulator/opendc-simulator/opendc-simulator-compute/src
diff options
context:
space:
mode:
Diffstat (limited to 'simulator/opendc-simulator/opendc-simulator-compute/src')
-rw-r--r--simulator/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/workload/SimTraceWorkload.kt5
1 files changed, 3 insertions, 2 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 2442d748..694a928b 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
@@ -50,14 +50,15 @@ public class SimTraceWorkload(public val trace: Sequence<Fragment>) : SimWorkloa
override fun onNext(ctx: SimResourceContext): SimResourceCommand {
val now = ctx.clock.millis()
val fragment = fragment ?: return SimResourceCommand.Exit
- val work = (fragment.duration / 1000) * fragment.usage
+ val usage = fragment.usage / fragment.cores
+ val work = (fragment.duration / 1000) * usage
val deadline = offset + fragment.duration
assert(deadline >= now) { "Deadline already passed" }
val cmd =
if (cpu.id < fragment.cores && work > 0.0)
- SimResourceCommand.Consume(work, fragment.usage, deadline)
+ SimResourceCommand.Consume(work, usage, deadline)
else
SimResourceCommand.Idle(deadline)