diff options
| author | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2021-05-04 14:45:23 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-05-04 14:45:23 +0200 |
| commit | e021d46ab1601d0c3a00724358164483608f6297 (patch) | |
| tree | 0a57294f06102a57a42ed24bbbca34591ee7da34 /opendc-simulator | |
| parent | 1ce1210be893e7333dfa09266f6990af87c98dc2 (diff) | |
| parent | 652b8691143f6e65e192de6b940fbfa0a50784e2 (diff) | |
exp: Fix power draw reporting
This pull request fixes an issue with the power draw reporting in experiments.
Previously, when the power draw of a machine did not change in subsequent metric collection cycles,
the power draw would be reported as zero.
* Update power draw as soon as the machine is started.
* Use OpenTelemetry view to aggregate based on the power draw's last reported value.
Diffstat (limited to 'opendc-simulator')
| -rw-r--r-- | opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/SimAbstractMachine.kt | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/SimAbstractMachine.kt b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/SimAbstractMachine.kt index 0244c5c1..f6324e13 100644 --- a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/SimAbstractMachine.kt +++ b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/SimAbstractMachine.kt @@ -85,6 +85,9 @@ public abstract class SimAbstractMachine(private val clock: Clock) : SimMachine _speed = DoubleArray(model.cpus.size) { 0.0 } var totalSpeed = 0.0 + // Before the workload starts, initialize the initial power draw + updateUsage(0.0) + workload.onStart(ctx) for (cpu in cpus) { |
