summaryrefslogtreecommitdiff
path: root/opendc-compute/opendc-compute-service/src/main
diff options
context:
space:
mode:
authorDante Niewenhuis <d.niewenhuis@hotmail.com>2024-09-16 11:29:26 +0200
committerGitHub <noreply@github.com>2024-09-16 11:29:26 +0200
commit4a010c6b9e033314a2624a0756dcdc7f17010d9d (patch)
tree70dc26e98cf8421eb5db7f62cf63d4ea2399c505 /opendc-compute/opendc-compute-service/src/main
parent5047e4a25a0814f96852882f02c4017e1d5f81e7 (diff)
All simulation are now run with a single CPU and single MemoryUnit. multi CPUs are combined into one. This is for performance and explainability. (#255)
Diffstat (limited to 'opendc-compute/opendc-compute-service/src/main')
-rw-r--r--opendc-compute/opendc-compute-service/src/main/java/org/opendc/compute/service/driver/HostModel.java4
-rw-r--r--opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/VCpuCapacityFilter.kt2
-rw-r--r--opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/weights/CoreRamWeigher.kt2
-rw-r--r--opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/weights/VCpuCapacityWeigher.kt2
-rw-r--r--opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/weights/VCpuWeigher.kt2
5 files changed, 6 insertions, 6 deletions
diff --git a/opendc-compute/opendc-compute-service/src/main/java/org/opendc/compute/service/driver/HostModel.java b/opendc-compute/opendc-compute-service/src/main/java/org/opendc/compute/service/driver/HostModel.java
index 2d45817b..87464fe1 100644
--- a/opendc-compute/opendc-compute-service/src/main/java/org/opendc/compute/service/driver/HostModel.java
+++ b/opendc-compute/opendc-compute-service/src/main/java/org/opendc/compute/service/driver/HostModel.java
@@ -26,7 +26,7 @@ package org.opendc.compute.service.driver;
* Record describing the static machine properties of the host.
*
* @param cpuCapacity The total CPU capacity of the host in MHz.
- * @param cpuCount The number of logical processing cores available for this host.
+ * @param coreCount The number of logical processing cores available for this host.
* @param memoryCapacity The amount of memory available for this host in MB.
*/
-public record HostModel(double cpuCapacity, int cpuCount, int coreCount, long memoryCapacity) {}
+public record HostModel(double cpuCapacity, int coreCount, long memoryCapacity) {}
diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/VCpuCapacityFilter.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/VCpuCapacityFilter.kt
index f87658cd..5af7ccf0 100644
--- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/VCpuCapacityFilter.kt
+++ b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/VCpuCapacityFilter.kt
@@ -36,7 +36,7 @@ public class VCpuCapacityFilter : HostFilter {
): Boolean {
val requiredCapacity = task.flavor.meta["cpu-capacity"] as? Double
val hostModel = host.host.model
- val availableCapacity = hostModel.cpuCapacity / hostModel.cpuCount
+ val availableCapacity = hostModel.cpuCapacity
return requiredCapacity == null || availableCapacity >= (requiredCapacity / task.flavor.coreCount)
}
diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/weights/CoreRamWeigher.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/weights/CoreRamWeigher.kt
index d84f5e68..6e320bf4 100644
--- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/weights/CoreRamWeigher.kt
+++ b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/weights/CoreRamWeigher.kt
@@ -37,7 +37,7 @@ public class CoreRamWeigher(override val multiplier: Double = 1.0) : HostWeigher
host: HostView,
task: Task,
): Double {
- return host.availableMemory.toDouble() / host.host.model.cpuCount
+ return host.availableMemory.toDouble()
}
override fun toString(): String = "CoreRamWeigher"
diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/weights/VCpuCapacityWeigher.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/weights/VCpuCapacityWeigher.kt
index 6d1482ff..5f99cab3 100644
--- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/weights/VCpuCapacityWeigher.kt
+++ b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/weights/VCpuCapacityWeigher.kt
@@ -35,7 +35,7 @@ public class VCpuCapacityWeigher(override val multiplier: Double = 1.0) : HostWe
): Double {
val model = host.host.model
val requiredCapacity = task.flavor.meta["cpu-capacity"] as? Double ?: 0.0
- return model.cpuCapacity / model.cpuCount - requiredCapacity / task.flavor.coreCount
+ return model.cpuCapacity - requiredCapacity / task.flavor.coreCount
}
override fun toString(): String = "VCpuWeigher"
diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/weights/VCpuWeigher.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/weights/VCpuWeigher.kt
index dfc30b54..0c3d9c21 100644
--- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/weights/VCpuWeigher.kt
+++ b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/weights/VCpuWeigher.kt
@@ -39,7 +39,7 @@ public class VCpuWeigher(private val allocationRatio: Double, override val multi
host: HostView,
task: Task,
): Double {
- return host.host.model.cpuCount * allocationRatio - host.provisionedCores
+ return allocationRatio - host.provisionedCores
}
override fun toString(): String = "VCpuWeigher"