From 10c47102d6133b86e4c39df96fd25a91010a9864 Mon Sep 17 00:00:00 2001 From: Dante Niewenhuis Date: Wed, 14 Feb 2024 11:52:32 +0100 Subject: Updated metrics and parquet output (#195) * Updated metrics and parquet output * fixed typos --- .../src/main/java/org/opendc/simulator/compute/SimPsu.java | 2 +- .../java/org/opendc/simulator/compute/SimPsuFactories.java | 12 ++++++------ .../kotlin/org/opendc/simulator/compute/SimMachineTest.kt | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'opendc-simulator') diff --git a/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/SimPsu.java b/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/SimPsu.java index 7f1f97a0..68dae4bf 100644 --- a/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/SimPsu.java +++ b/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/SimPsu.java @@ -43,7 +43,7 @@ public abstract class SimPsu extends SimPowerInlet { /** * Return the instantaneous power usage of the machine (in W) measured at the inlet of the power supply. */ - public abstract double getPowerUsage(); + public abstract double getPowerDraw(); /** * Return the cumulated energy usage of the machine (in J) measured at the inlet of the powers supply. diff --git a/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/SimPsuFactories.java b/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/SimPsuFactories.java index 05b40cf8..5b118429 100644 --- a/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/SimPsuFactories.java +++ b/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/SimPsuFactories.java @@ -82,7 +82,7 @@ public class SimPsuFactories { } @Override - public double getPowerUsage() { + public double getPowerDraw() { return 0; } @@ -123,7 +123,7 @@ public class SimPsuFactories { private double totalUsage; private long lastUpdate; - private double powerUsage; + private double powerDraw; private double energyUsage; private final InHandler handler = new InHandler() { @@ -154,8 +154,8 @@ public class SimPsuFactories { } @Override - public double getPowerUsage() { - return powerUsage; + public double getPowerDraw() { + return powerDraw; } @Override @@ -186,7 +186,7 @@ public class SimPsuFactories { double usage = model.computePower(totalUsage / targetFreq); out.push((float) usage); - powerUsage = usage; + powerDraw = usage; return Long.MAX_VALUE; } @@ -207,7 +207,7 @@ public class SimPsuFactories { long duration = now - lastUpdate; if (duration > 0) { // Compute the energy usage of the machine - energyUsage += powerUsage * duration * 0.001; + energyUsage += powerDraw * duration * 0.001; } } } diff --git a/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/SimMachineTest.kt b/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/SimMachineTest.kt index 8c4e01a9..28acaef4 100644 --- a/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/SimMachineTest.kt +++ b/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/SimMachineTest.kt @@ -148,7 +148,7 @@ class SimMachineTest { yield() assertAll( - { assertEquals(100.0, machine.psu.powerUsage) }, + { assertEquals(100.0, machine.psu.powerDraw) }, { assertEquals(100.0f, source.powerDraw) } ) } -- cgit v1.2.3