summaryrefslogtreecommitdiff
path: root/opendc/opendc-compute/src
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2020-04-12 15:27:58 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2020-04-12 15:27:58 +0200
commitcc6912418f554c4dadd8e95d80b4c229d947907b (patch)
tree63d6d4cad2aae14d47310cd658f5bada00f99764 /opendc/opendc-compute/src
parent8a8ebe8b2630007d900770d434b985a2f62303a8 (diff)
bug: Fix scheduling slices to minimum 5 min
Diffstat (limited to 'opendc/opendc-compute/src')
-rw-r--r--opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/driver/SimpleVirtDriver.kt5
1 files changed, 3 insertions, 2 deletions
diff --git a/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/driver/SimpleVirtDriver.kt b/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/driver/SimpleVirtDriver.kt
index 9b741ce1..d81b8825 100644
--- a/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/driver/SimpleVirtDriver.kt
+++ b/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/driver/SimpleVirtDriver.kt
@@ -182,7 +182,7 @@ class SimpleVirtDriver(
val pCPUs = hostContext.cpus.indices.sortedBy { hostContext.cpus[it].frequency }
val vms = mutableMapOf<VmServerContext, Collection<CpuRequest>>()
- val requests = TreeSet<CpuRequest>(cpuRequestComparator)
+ val requests = TreeSet(cpuRequestComparator)
val usage = DoubleArray(hostContext.cpus.size)
val burst = LongArray(hostContext.cpus.size)
@@ -239,7 +239,8 @@ class SimpleVirtDriver(
deadline = min(deadline, req.vm.deadline)
}
- duration = ceil(duration)
+ // XXX We set the minimum duration to 5 minutes here to prevent the rounding issues that are occurring with the FLOPs.
+ duration = max(300.0, ceil(duration))
val totalAllocatedUsage = maxUsage - availableUsage
var totalAllocatedBurst = 0L