summaryrefslogtreecommitdiff
path: root/opendc-simulator/opendc-simulator-compute/src/main
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2021-08-25 18:15:07 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2021-08-25 18:15:07 +0200
commite6dd553cf77445083f2c7632bd3b4c3611d76d0a (patch)
tree555e1c1763b8a16291b957ecd5b2917acf74cf96 /opendc-simulator/opendc-simulator-compute/src/main
parentf111081627280d4e7e1d7147c56cdce708e32433 (diff)
fix(simulator): Eliminate unnecessary double to long conversions
This change eliminates unnecessary double to long conversions in the simulator. Previously, we used longs to denote the amount of work. However, in the mean time we have switched to doubles in the lower stack.
Diffstat (limited to 'opendc-simulator/opendc-simulator-compute/src/main')
-rw-r--r--opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/SimFairShareHypervisor.kt8
-rw-r--r--opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/SimHypervisor.kt8
2 files changed, 8 insertions, 8 deletions
diff --git a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/SimFairShareHypervisor.kt b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/SimFairShareHypervisor.kt
index c31b1f6b..3b44292d 100644
--- a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/SimFairShareHypervisor.kt
+++ b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/SimFairShareHypervisor.kt
@@ -77,10 +77,10 @@ public class SimFairShareHypervisor(
if (timestamp > lastReport) {
listener.onSliceFinish(
this@SimFairShareHypervisor,
- (counters.demand - lastDemand).toLong(),
- (counters.actual - lastActual).toLong(),
- (counters.overcommit - lastOvercommit).toLong(),
- (counters.interference - lastInterference).toLong(),
+ counters.demand - lastDemand,
+ counters.actual - lastActual,
+ counters.overcommit - lastOvercommit,
+ counters.interference - lastInterference,
lastCpuUsage,
lastCpuDemand
)
diff --git a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/SimHypervisor.kt b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/SimHypervisor.kt
index d3996914..af28c346 100644
--- a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/SimHypervisor.kt
+++ b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/SimHypervisor.kt
@@ -64,10 +64,10 @@ public interface SimHypervisor : SimWorkload {
*/
public fun onSliceFinish(
hypervisor: SimHypervisor,
- requestedWork: Long,
- grantedWork: Long,
- overcommittedWork: Long,
- interferedWork: Long,
+ requestedWork: Double,
+ grantedWork: Double,
+ overcommittedWork: Double,
+ interferedWork: Double,
cpuUsage: Double,
cpuDemand: Double
)