From b6153bbf24970a5b4ba103de00e440911dcc8694 Mon Sep 17 00:00:00 2001 From: Dante Niewenhuis Date: Mon, 17 Jun 2024 06:14:32 +0200 Subject: Fixed CPU limit problem (#234) * Fixed a problem which caused the CPU limit to be much lower than it should be. AllocationPolicy is now properly exposed to the user * Fixed tests * spotless kotlin --- .../src/main/kotlin/org/opendc/compute/simulator/SimHost.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'opendc-compute/opendc-compute-simulator/src/main') 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 00f2acb3..624a612f 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 @@ -96,7 +96,7 @@ public class SimHost( private val model: HostModel = HostModel( - machine.model.cpus.sumOf { it.frequency * it.node.coreCount }, + machine.model.cpus.sumOf { it.frequency }, machine.model.cpus.size, machine.model.cpus.sumOf { it.node.coreCount }, machine.model.memory.sumOf { it.size }, @@ -364,7 +364,7 @@ public class SimHost( private var localUptime = 0L private var localDowntime = 0L private var localBootTime: Instant? = null - private val localCpuLimit = machine.model.cpus.sumOf { it.frequency } + private val localCpuLimit = machine.model.cpus.sumOf { it.frequency * it.node.coreCount } /** * Helper function to track the uptime of a machine. -- cgit v1.2.3