summaryrefslogtreecommitdiff
path: root/opendc-simulator/opendc-simulator-compute/src/main
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2021-08-25 20:46:36 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2021-08-25 20:50:43 +0200
commitb0f6402f60ddbba1aad7e198fe6757792337f4d4 (patch)
tree276eddd32297cf370ca37504ac0ef770f55ec4fe /opendc-simulator/opendc-simulator-compute/src/main
parent8f58ae2b28518c6a2ed2fe3657984f417b3d3ddb (diff)
refactor(compute): Measure power draw without PSU overhead
This change updates the SimHost implementation to measure the power draw of the machine without PSU overhead to make the results more realistic.
Diffstat (limited to 'opendc-simulator/opendc-simulator-compute/src/main')
-rw-r--r--opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/SimBareMetalMachine.kt6
1 files changed, 6 insertions, 0 deletions
diff --git a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/SimBareMetalMachine.kt b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/SimBareMetalMachine.kt
index 2c711945..639ca450 100644
--- a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/SimBareMetalMachine.kt
+++ b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/SimBareMetalMachine.kt
@@ -49,6 +49,12 @@ public class SimBareMetalMachine(
parent: SimResourceSystem? = null,
) : SimAbstractMachine(interpreter, parent, model) {
/**
+ * The power draw of the machine onto the PSU.
+ */
+ public val powerDraw: Double
+ get() = powerDriverLogic.computePower()
+
+ /**
* The processing units of the machine.
*/
override val cpus: List<SimProcessingUnit> = model.cpus.map { cpu ->