diff options
Diffstat (limited to 'opendc-compute')
2 files changed, 11 insertions, 5 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 e6b36dba..f8c7afbd 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 @@ -111,7 +111,7 @@ private fun HostJSONSpec.toHostSpecs( ): HostSpec { val unknownProcessingNode = ProcessingNode("unknown", "unknown", "unknown", cpus.sumOf { it.coreCount }) - val units = cpus.flatMap { cpu -> List(cpu.count) { cpu.toProcessingUnit(unknownProcessingNode) }.flatten() } + val units = cpus.flatMap { cpu -> List(cpu.count) { cpu.toProcessingUnits(unknownProcessingNode) }.flatten() } val unknownMemoryUnit = MemoryUnit(memory.vendor, memory.modelName, memory.memorySpeed, memory.memorySize) val machineModel = @@ -140,7 +140,9 @@ private fun HostJSONSpec.toHostSpecs( */ private var globalCoreId = 0 -private fun CPUJSONSpec.toProcessingUnit(unknownProcessingNode: ProcessingNode): List<ProcessingUnit> { +private fun CPUJSONSpec.toProcessingUnits(unknownProcessingNode: ProcessingNode): List<ProcessingUnit> { val units = List(coreCount) { ProcessingUnit(unknownProcessingNode, globalCoreId++, coreSpeed) } return units + +// return listOf(ProcessingUnit(unknownProcessingNode, globalCoreId++, coreSpeed)) } diff --git a/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/specs/JSONSpecs.kt b/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/specs/JSONSpecs.kt index 5e0af541..8f73f524 100644 --- a/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/specs/JSONSpecs.kt +++ b/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/specs/JSONSpecs.kt @@ -64,7 +64,7 @@ public data class HostJSONSpec( val name: String = "Host", val cpus: List<CPUJSONSpec>, val memory: MemoryJSONSpec, - val powerModel: PowerModelJSONSpec = PowerModelJSONSpec("linear", 350.0, 200.0, 400.0), + val powerModel: PowerModelJSONSpec = PowerModelJSONSpec("linear", 350.0, 400.0, 200.0), val count: Int = 1, ) @@ -109,6 +109,10 @@ public data class MemoryJSONSpec( public data class PowerModelJSONSpec( val modelType: String, val power: Double = 400.0, - val idlePower: Double, val maxPower: Double, -) + val idlePower: Double, +) { + init { + require(maxPower >= idlePower) { "The max power of a power model can not be less than the idle power" } + } +} |
