diff options
| author | Dante Niewenhuis <d.niewenhuis@hotmail.com> | 2025-03-21 16:46:40 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-21 16:46:40 +0100 |
| commit | 702b739a53115f14c402dc24ec30468ef47db2d8 (patch) | |
| tree | a97202bf94aac958db213960f5be4484a3997713 /opendc-simulator/opendc-simulator-compute/src/main/java | |
| parent | f16e799e0c12d3181edad1ef307cd7084216ed9f (diff) | |
Fixed a small bug that made idle host consume no energy at the start (#322)
Diffstat (limited to 'opendc-simulator/opendc-simulator-compute/src/main/java')
| -rw-r--r-- | opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/cpu/SimCpu.java | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/cpu/SimCpu.java b/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/cpu/SimCpu.java index fadfc4d6..1a56650e 100644 --- a/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/cpu/SimCpu.java +++ b/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/cpu/SimCpu.java @@ -44,7 +44,7 @@ public final class SimCpu extends FlowNode implements FlowSupplier, FlowConsumer private double currentCpuUtilization = 0.0f; private double currentCpuSupplied = 0.0f; // cpu capacity supplied to the mux - private double currentPowerDemand = 0.0f; // power demanded of the psu + private double currentPowerDemand; // power demanded of the psu private double currentPowerSupplied = 0.0f; // cpu capacity supplied by the psu private double maxCapacity; @@ -109,12 +109,13 @@ public final class SimCpu extends FlowNode implements FlowSupplier, FlowConsumer this.cpuModel = cpuModel; this.maxCapacity = this.cpuModel.getTotalCapacity(); - // TODO: connect this to the front-end this.cpuPowerModel = powerModel; this.lastCounterUpdate = clock.millis(); this.cpuFrequencyInv = 1 / this.maxCapacity; + + this.currentPowerDemand = this.cpuPowerModel.computePower(this.currentCpuUtilization); } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
