summaryrefslogtreecommitdiff
path: root/opendc/opendc-compute
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2020-03-11 10:26:35 +0100
committerFabian Mastenbroek <mail.fabianm@gmail.com>2020-03-11 10:26:35 +0100
commite357ad22dde4c3c046beded29c0eb9325e199ebb (patch)
tree94fb31cce372936ab6b2e4c5cc119a249f74ca34 /opendc/opendc-compute
parent62160b0e84fb56bf6adc2b18f5df73afb378e749 (diff)
bug: Propagate remaining burst correctly
Diffstat (limited to 'opendc/opendc-compute')
-rw-r--r--opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/driver/hypervisor/HypervisorVirtDriver.kt8
1 files changed, 4 insertions, 4 deletions
diff --git a/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/driver/hypervisor/HypervisorVirtDriver.kt b/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/driver/hypervisor/HypervisorVirtDriver.kt
index 6fe11c28..05e1ab90 100644
--- a/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/driver/hypervisor/HypervisorVirtDriver.kt
+++ b/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/driver/hypervisor/HypervisorVirtDriver.kt
@@ -155,10 +155,10 @@ class HypervisorVirtDriver(
}
}
- val granted = burst.clone()
+ val remainder = burst.clone()
// We run the total burst on the host processor. Note that this call may be cancelled at any moment in
// time, so not all of the burst may be executed.
- hostContext.run(granted, usage, deadline)
+ hostContext.run(remainder, usage, deadline)
val end = simulationContext.clock.millis()
// No work was performed
@@ -178,7 +178,7 @@ class HypervisorVirtDriver(
val fraction = actualUsage / usage[i]
// Compute the burst time that the VM was actually granted
- val grantedBurst = max(0, actualBurst - ceil(burst[i] * fraction).toLong())
+ val grantedBurst = max(0, actualBurst - ceil(remainder[i] * fraction).toLong())
// Compute remaining burst time to be executed for the request
vm.requestedBurst[i] = max(0, vm.requestedBurst[i] - grantedBurst)
@@ -194,7 +194,7 @@ class HypervisorVirtDriver(
monitor.onSliceFinish(
end,
burst[i],
- granted[i],
+ remainder[i],
vms.size,
hostContext.server
)