summaryrefslogtreecommitdiff
path: root/opendc-compute/opendc-compute-simulator/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'opendc-compute/opendc-compute-simulator/src/main')
-rw-r--r--opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/SimHost.kt12
1 files changed, 9 insertions, 3 deletions
diff --git a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/SimHost.kt b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/SimHost.kt
index 68667a8c..f08a7e1e 100644
--- a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/SimHost.kt
+++ b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/SimHost.kt
@@ -41,6 +41,7 @@ import org.opendc.simulator.compute.model.MemoryUnit
import org.opendc.simulator.compute.power.ConstantPowerModel
import org.opendc.simulator.compute.power.PowerModel
import org.opendc.simulator.failures.FailureDomain
+import org.opendc.simulator.resources.SimResourceInterpreter
import java.time.Clock
import java.util.*
import kotlin.coroutines.CoroutineContext
@@ -94,18 +95,23 @@ public class SimHost(
/**
* Current total memory use of the images on this hypervisor.
*/
- private var availableMemory: Long = model.memory.map { it.size }.sum()
+ private var availableMemory: Long = model.memory.sumOf { it.size }
+
+ /**
+ * The resource interpreter to schedule the resource interactions.
+ */
+ private val interpreter = SimResourceInterpreter(context, clock)
/**
* The machine to run on.
*/
- public val machine: SimBareMetalMachine = SimBareMetalMachine(context, clock, model, scalingGovernor, scalingDriver)
+ public val machine: SimBareMetalMachine = SimBareMetalMachine(interpreter, model, scalingGovernor, scalingDriver)
/**
* The hypervisor to run multiple workloads.
*/
public val hypervisor: SimHypervisor = hypervisor.create(
- scope.coroutineContext, clock,
+ interpreter,
object : SimHypervisor.Listener {
override fun onSliceFinish(
hypervisor: SimHypervisor,