summaryrefslogtreecommitdiff
path: root/opendc-compute/opendc-compute-topology
diff options
context:
space:
mode:
Diffstat (limited to 'opendc-compute/opendc-compute-topology')
-rw-r--r--opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/TopologyFactories.kt15
-rw-r--r--opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/specs/HostSpec.kt11
2 files changed, 11 insertions, 15 deletions
diff --git a/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/TopologyFactories.kt b/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/TopologyFactories.kt
index e0fba34f..9e637b1b 100644
--- a/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/TopologyFactories.kt
+++ b/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/TopologyFactories.kt
@@ -28,11 +28,10 @@ import org.opendc.compute.topology.specs.ClusterSpec
import org.opendc.compute.topology.specs.HostJSONSpec
import org.opendc.compute.topology.specs.HostSpec
import org.opendc.compute.topology.specs.TopologySpec
-import org.opendc.simulator.compute.SimPsuFactories
-import org.opendc.simulator.compute.model.Cpu
-import org.opendc.simulator.compute.model.MachineModel
-import org.opendc.simulator.compute.model.MemoryUnit
-import org.opendc.simulator.compute.power.getPowerModel
+import org.opendc.simulator.compute.cpu.getPowerModel
+import org.opendc.simulator.compute.models.CpuModel
+import org.opendc.simulator.compute.models.MachineModel
+import org.opendc.simulator.compute.models.MemoryUnit
import java.io.File
import java.io.InputStream
import java.util.SplittableRandom
@@ -120,10 +119,10 @@ private fun HostJSONSpec.toHostSpecs(
): HostSpec {
val units =
List(cpu.count) {
- Cpu(
+ CpuModel(
globalCoreId++,
cpu.coreCount,
- cpu.coreSpeed.toMHz(),
+ cpu.coreSpeed.toMHz().toFloat(),
)
}
@@ -150,7 +149,7 @@ private fun HostJSONSpec.toHostSpecs(
hostName,
mapOf("cluster" to clusterId),
machineModel,
- SimPsuFactories.simple(powerModel),
+ powerModel,
)
hostId++
diff --git a/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/specs/HostSpec.kt b/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/specs/HostSpec.kt
index 9857f70a..1956ffde 100644
--- a/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/specs/HostSpec.kt
+++ b/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/specs/HostSpec.kt
@@ -22,10 +22,8 @@
package org.opendc.compute.topology.specs
-import org.opendc.simulator.compute.SimPsuFactories
-import org.opendc.simulator.compute.SimPsuFactory
-import org.opendc.simulator.compute.model.MachineModel
-import org.opendc.simulator.flow2.mux.FlowMultiplexerFactory
+import org.opendc.simulator.compute.cpu.CpuPowerModel
+import org.opendc.simulator.compute.models.MachineModel
import java.util.UUID
/**
@@ -35,7 +33,7 @@ import java.util.UUID
* @param name The name of the host.
* @param meta The metadata of the host.
* @param model The physical model of the machine.
- * @param psuFactory The [SimPsuFactory] to construct the PSU that models the power consumption of the machine.
+ * @param cpuPowerModel The [SimPsuFactory] to construct the PSU that models the power consumption of the machine.
* @param multiplexerFactory The [FlowMultiplexerFactory] that is used to multiplex the virtual machines over the host.
*/
public data class HostSpec(
@@ -43,6 +41,5 @@ public data class HostSpec(
val name: String,
val meta: Map<String, Any>,
val model: MachineModel,
- val psuFactory: SimPsuFactory = SimPsuFactories.noop(),
- val multiplexerFactory: FlowMultiplexerFactory = FlowMultiplexerFactory.maxMinMultiplexer(),
+ val cpuPowerModel: CpuPowerModel,
)