summaryrefslogtreecommitdiff
path: root/opendc-compute/opendc-compute-simulator/src/main
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2021-06-20 22:21:39 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2021-06-21 12:19:42 +0200
commitdf3c9dc3fcd2f89910575bfdc24a3db3af9eba0f (patch)
tree136246812bbf7b6063aa7b324397d580a1669dff /opendc-compute/opendc-compute-simulator/src/main
parentb8b0f39028af90fa54b42a00214b2ea9a5e48e2e (diff)
exp: Enable interpreter sharing across hosts
This change enables the experiments to share the SimResourceInterpreter across multiple hosts, which allows updates to be scheduled efficiently for all machines at the same time. This is especially beneficial if the machines operate on the same time slices.
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.kt11
1 files changed, 3 insertions, 8 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 540e27fe..557fa97a 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
@@ -56,7 +56,7 @@ public class SimHost(
model: SimMachineModel,
override val meta: Map<String, Any>,
context: CoroutineContext,
- clock: Clock,
+ interpreter: SimResourceInterpreter,
meter: Meter,
hypervisor: SimHypervisorProvider,
scalingGovernor: ScalingGovernor,
@@ -70,12 +70,12 @@ public class SimHost(
model: SimMachineModel,
meta: Map<String, Any>,
context: CoroutineContext,
- clock: Clock,
+ interpreter: SimResourceInterpreter,
meter: Meter,
hypervisor: SimHypervisorProvider,
powerModel: PowerModel = ConstantPowerModel(0.0),
mapper: SimWorkloadMapper = SimMetaWorkloadMapper(),
- ) : this(uid, name, model, meta, context, clock, meter, hypervisor, PerformanceScalingGovernor(), SimplePowerDriver(powerModel), mapper)
+ ) : this(uid, name, model, meta, context, interpreter, meter, hypervisor, PerformanceScalingGovernor(), SimplePowerDriver(powerModel), mapper)
/**
* The [CoroutineScope] of the host bounded by the lifecycle of the host.
@@ -98,11 +98,6 @@ public class SimHost(
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(interpreter, model, scalingDriver)