diff options
| author | Dante Niewenhuis <d.niewenhuis@hotmail.com> | 2024-11-26 15:28:48 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-11-26 15:28:48 +0100 |
| commit | a2caf51f6e4691736e36ee41a178c6f6bbae3d67 (patch) | |
| tree | b7313054453bcc4000b21c0c44a06fb81a7a85f1 /opendc-compute/opendc-compute-simulator/src | |
| parent | ec73210b675fd90568c5193e6ae6ef82ce81be6c (diff) | |
Connected the cpu power model given by the topology.json to SimCpu.java (#274)
* Connected the cpu power model given by the topology.json to SimCpu.java
* ran spotless
Diffstat (limited to 'opendc-compute/opendc-compute-simulator/src')
2 files changed, 8 insertions, 4 deletions
diff --git a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/host/SimHost.kt b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/host/SimHost.kt index 0b9916ed..e1ccdfaf 100644 --- a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/host/SimHost.kt +++ b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/host/SimHost.kt @@ -32,6 +32,7 @@ import org.opendc.compute.simulator.telemetry.GuestSystemStats import org.opendc.compute.simulator.telemetry.HostCpuStats import org.opendc.compute.simulator.telemetry.HostSystemStats import org.opendc.simulator.Multiplexer +import org.opendc.simulator.compute.cpu.CpuPowerModel import org.opendc.simulator.compute.machine.SimMachine import org.opendc.simulator.compute.models.MachineModel import org.opendc.simulator.compute.models.MemoryUnit @@ -60,6 +61,7 @@ public class SimHost( private val clock: InstantSource, private val graph: FlowGraph, private val machineModel: MachineModel, + private val cpuPowerModel: CpuPowerModel, private val powerMux: Multiplexer, ) : AutoCloseable { /** @@ -83,8 +85,8 @@ public class SimHost( private val model: HostModel = HostModel( - machineModel.cpu.totalCapacity, - machineModel.cpu.coreCount, + machineModel.cpuModel.totalCapacity, + machineModel.cpuModel.coreCount, machineModel.memory.size, ) @@ -108,7 +110,7 @@ public class SimHost( private var totalUptime = 0L private var totalDowntime = 0L private var bootTime: Instant? = null - private val cpuLimit = machineModel.cpu.totalCapacity + private val cpuLimit = machineModel.cpuModel.totalCapacity init { launch() @@ -130,6 +132,7 @@ public class SimHost( this.graph, this.machineModel, this.powerMux, + this.cpuPowerModel, ) { cause -> hostState = if (cause != null) HostState.ERROR else HostState.DOWN } @@ -343,7 +346,7 @@ public class SimHost( * Convert flavor to machine model. */ private fun Flavor.toMachineModel(): MachineModel { - return MachineModel(simMachine!!.machineModel.cpu, MemoryUnit("Generic", "Generic", 3200.0, memorySize)) + return MachineModel(simMachine!!.machineModel.cpuModel, MemoryUnit("Generic", "Generic", 3200.0, memorySize)) } /** diff --git a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/provisioner/HostsProvisioningStep.kt b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/provisioner/HostsProvisioningStep.kt index 30b50c4b..8e7293c8 100644 --- a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/provisioner/HostsProvisioningStep.kt +++ b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/provisioner/HostsProvisioningStep.kt @@ -77,6 +77,7 @@ public class HostsProvisioningStep internal constructor( ctx.dispatcher.timeSource, graph, hostSpec.model, + hostSpec.cpuPowerModel, powerMux, ) |
