diff options
| author | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2022-06-15 22:01:34 +0200 |
|---|---|---|
| committer | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2022-06-15 22:23:59 +0200 |
| commit | 282f199e6f16350123a915b06faff62ca82be91b (patch) | |
| tree | b2b698d85f7397ef67485d52128a9390f40f7252 /opendc-simulator/opendc-simulator-compute/src | |
| parent | f51bf570f143faf69e3ae361cceac5f0c2420d88 (diff) | |
fix(sim/compute): Always recompute power usage
This change fixes an issue in the `SimBareMetalMachine` implementation
where the power usage was only updated after a non-zero duration. However,
this would mean that OpenDC would possibly report incorrect power usage
values when multiple convergence calls occured at the same timestamp.
Diffstat (limited to 'opendc-simulator/opendc-simulator-compute/src')
| -rw-r--r-- | opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/SimBareMetalMachine.kt | 3 |
1 files changed, 2 insertions, 1 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 68792c72..63a82e78 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 @@ -91,8 +91,9 @@ public class SimBareMetalMachine( if (duration > 0) { // Compute the power and energy usage of the machine computeEnergyUsage(now) - _powerUsage = powerDriverLogic.computePower() } + + _powerUsage = powerDriverLogic.computePower() } init { |
