summaryrefslogtreecommitdiff
path: root/opendc-simulator/opendc-simulator-compute/src/test
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2021-05-03 22:32:32 +0200
committerGitHub <noreply@github.com>2021-05-03 22:32:32 +0200
commit1ce1210be893e7333dfa09266f6990af87c98dc2 (patch)
tree3bfdc735ef39353c6c715399c2d9890ff423d4c4 /opendc-simulator/opendc-simulator-compute/src/test
parent17ffe995ee06d5755cd3943a5ea14f982884009e (diff)
parent80335a49513f3e74228aa1bfb998dd54855f68e2 (diff)
simulator: Add support for central resource scheduling (#126)
This pull request adds support for central resource scheduling. This enables possible optimizations in the future where we can efficiently schedule resource updates. * Introduce `SimResourceScheduler` which centralizes the logic for scheduling resource interrupts. * Fix benchmarks * Add generic approach for reporting resource events * Simplify scheduling logic of resource aggregator. **Breaking API Changes** * Classes in `opendc-simulator-resources` now take `SimResourceScheduler` as opposed to a `CoroutineContext` and `Clock`.
Diffstat (limited to 'opendc-simulator/opendc-simulator-compute/src/test')
-rw-r--r--opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/SimHypervisorTest.kt5
1 files changed, 3 insertions, 2 deletions
diff --git a/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/SimHypervisorTest.kt b/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/SimHypervisorTest.kt
index a067dd2e..8886caa7 100644
--- a/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/SimHypervisorTest.kt
+++ b/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/SimHypervisorTest.kt
@@ -39,6 +39,7 @@ import org.opendc.simulator.compute.model.ProcessingUnit
import org.opendc.simulator.compute.power.ConstantPowerModel
import org.opendc.simulator.compute.workload.SimTraceWorkload
import org.opendc.simulator.core.runBlockingSimulation
+import org.opendc.simulator.resources.SimResourceSchedulerTrampoline
/**
* Test suite for the [SimHypervisor] class.
@@ -93,7 +94,7 @@ internal class SimHypervisorTest {
)
val machine = SimBareMetalMachine(coroutineContext, clock, model, PerformanceScalingGovernor(), SimpleScalingDriver(ConstantPowerModel(0.0)))
- val hypervisor = SimFairShareHypervisor(listener)
+ val hypervisor = SimFairShareHypervisor(SimResourceSchedulerTrampoline(coroutineContext, clock), listener)
launch {
machine.run(hypervisor)
@@ -167,7 +168,7 @@ internal class SimHypervisorTest {
coroutineContext, clock, model, PerformanceScalingGovernor(),
SimpleScalingDriver(ConstantPowerModel(0.0))
)
- val hypervisor = SimFairShareHypervisor(listener)
+ val hypervisor = SimFairShareHypervisor(SimResourceSchedulerTrampoline(coroutineContext, clock), listener)
launch {
machine.run(hypervisor)