diff options
| author | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2021-04-07 21:59:13 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-07 21:59:13 +0200 |
| commit | 5d3b759b18fb0a4278b43dea6a9db478b07804a5 (patch) | |
| tree | 419dedda10f6a1f1865fbee4d1f546dd8876c940 /simulator/opendc-compute | |
| parent | 519141f9af525a853b40eb821e70ca209bc104bf (diff) | |
| parent | 3d707674ddfa96ae5c090a7c918350b0bef9b50f (diff) | |
simulator: Optimize bottlenecks in resource layer
This pull request addresses several bottlenecks that were present in the
`opendc-simulator-resources` layer and `TimerScheduler`.
These changes result into a 4x performance improvement for the energy experiments
we are currently doing.
* The use of `StateFlow` has been removed where possible. Profiling shows that
emitting changes to `StateFlow` becomes a bottleneck in a single-thread context.
* `SimSpeedConsumerAdapter` is an alternative for obtaining the changes in
speed of a resource.
**Breaking API Changes**
* `SimResourceSource` does not expose `speed` as `StateFlow` anymore. To monitor speed changes, use `SimSpeedConsumerAdapter`.
* Power draw in `SimBareMetalMachine` is not exposed as `StateFlow` anymore.
Diffstat (limited to 'simulator/opendc-compute')
| -rw-r--r-- | simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/SimHost.kt | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/SimHost.kt b/simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/SimHost.kt index 8e1aab44..89d01c57 100644 --- a/simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/SimHost.kt +++ b/simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/SimHost.kt @@ -104,7 +104,7 @@ public class SimHost( _cpuWorkInterference.record(interferedWork.toDouble()) _cpuUsage.record(cpuUsage) _cpuDemand.record(cpuDemand) - _cpuPower.record(machine.powerDraw.value) + _cpuPower.record(machine.powerDraw) } } ) |
