summaryrefslogtreecommitdiff
path: root/opendc-simulator/opendc-simulator-compute/src/main
diff options
context:
space:
mode:
authorRadu Nicolae <rnicolae04@gmail.com>2025-06-16 18:01:07 +0200
committerGitHub <noreply@github.com>2025-06-16 18:01:07 +0200
commit0df3d9ced743ac3385dd710c7133a6cf369b051c (patch)
treeeff5d6d67c275643e229731ba08c5fe7dc4ccd0a /opendc-simulator/opendc-simulator-compute/src/main
parentc7e303ad1b5217e2ff24cee9538ac841d6149706 (diff)
integrated M3SA, updated with tests and CpuPowerModels
Diffstat (limited to 'opendc-simulator/opendc-simulator-compute/src/main')
-rw-r--r--opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/cpu/CpuPowerModelsFactory.kt (renamed from opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/cpu/CPUPowerModelsFactory.kt)11
1 files changed, 10 insertions, 1 deletions
diff --git a/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/cpu/CPUPowerModelsFactory.kt b/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/cpu/CpuPowerModelsFactory.kt
index 3600756b..56610136 100644
--- a/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/cpu/CPUPowerModelsFactory.kt
+++ b/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/cpu/CpuPowerModelsFactory.kt
@@ -23,12 +23,14 @@
package org.opendc.simulator.compute.cpu
// TODO: couple this correctly
-public enum class CPUPowerModel {
+public enum class CPUPowerModelEnum {
Constant,
Sqrt,
Linear,
Square,
Cubic,
+ MSE,
+ Asymptotic,
}
public fun getPowerModel(
@@ -36,6 +38,9 @@ public fun getPowerModel(
power: Double,
maxPower: Double,
idlePower: Double,
+ calibrationFactor: Double = 1.0,
+ asymUtil: Double = 0.0,
+ dvfs: Boolean = true,
): CpuPowerModel {
return when (modelType) {
"constant" -> CpuPowerModels.constant(power)
@@ -43,6 +48,8 @@ public fun getPowerModel(
"linear" -> CpuPowerModels.linear(maxPower, idlePower)
"square" -> CpuPowerModels.square(maxPower, idlePower)
"cubic" -> CpuPowerModels.cubic(maxPower, idlePower)
+ "mse" -> CpuPowerModels.mse(maxPower, idlePower, calibrationFactor)
+ "asymptotic" -> CpuPowerModels.asymptotic(maxPower, idlePower, asymUtil, dvfs)
else -> throw IllegalArgumentException("Unknown power modelType $modelType")
}
@@ -55,6 +62,8 @@ public fun getPowerModel(modelType: String): CpuPowerModel {
"linear" -> CpuPowerModels.linear(350.0, 200.0)
"square" -> CpuPowerModels.square(350.0, 200.0)
"cubic" -> CpuPowerModels.cubic(350.0, 200.0)
+ "mse" -> CpuPowerModels.mse(350.0, 200.0, 1.0)
+ "asymptotic" -> CpuPowerModels.asymptotic(350.0, 200.0, 0.0, true)
else -> throw IllegalArgumentException("Unknown power modelType $modelType")
}