diff options
| author | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2021-04-07 16:26:00 +0200 |
|---|---|---|
| committer | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2021-04-07 20:38:46 +0200 |
| commit | 4e9f72b50473d73f9ca9e30a7fbeb97a8a1c0555 (patch) | |
| tree | 6d4855c6a93cfc41064e73b169e2f39d5530a5ae /simulator/opendc-simulator/opendc-simulator-compute/src/test/kotlin | |
| parent | 95a0ed6911f136fb25bb76d6b6e010bf66b8ba5b (diff) | |
simulator: Move away from StateFlow for low-level monitoring
This change removes the StateFlow speed property on the
SimResourceSource, as the overhead of emitting changes to the StateFlow
is too high in a single-thread context. Our new approach is to use
direct callbacks and counters.
Diffstat (limited to 'simulator/opendc-simulator/opendc-simulator-compute/src/test/kotlin')
2 files changed, 5 insertions, 5 deletions
diff --git a/simulator/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/cpufreq/DemandScalingGovernorTest.kt b/simulator/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/cpufreq/DemandScalingGovernorTest.kt index 19c06126..c02b6285 100644 --- a/simulator/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/cpufreq/DemandScalingGovernorTest.kt +++ b/simulator/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/cpufreq/DemandScalingGovernorTest.kt @@ -35,7 +35,7 @@ internal class DemandScalingGovernorTest { fun testSetDemandLimit() { val ctx = mockk<ScalingContext>(relaxUnitFun = true) - every { ctx.resource.speed.value } returns 2100.0 + every { ctx.resource.speed } returns 2100.0 val logic = DemandScalingGovernor().createLogic(ctx) diff --git a/simulator/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/cpufreq/PStateScalingDriverTest.kt b/simulator/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/cpufreq/PStateScalingDriverTest.kt index 5c30bc1f..c6f233a6 100644 --- a/simulator/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/cpufreq/PStateScalingDriverTest.kt +++ b/simulator/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/cpufreq/PStateScalingDriverTest.kt @@ -59,7 +59,7 @@ internal class PStateScalingDriverTest { val resource = mockk<SimResourceSource>() every { cpu.frequency } returns 4100.0 - every { resource.speed.value } returns 1200.0 + every { resource.speed } returns 1200.0 val driver = PStateScalingDriver( sortedMapOf( @@ -84,7 +84,7 @@ internal class PStateScalingDriverTest { val resource = mockk<SimResourceSource>() every { cpu.frequency } returns 4100.0 - every { resource.speed.value } returns 1200.0 + every { resource.speed } returns 1200.0 val driver = PStateScalingDriver( sortedMapOf( @@ -125,11 +125,11 @@ internal class PStateScalingDriverTest { val scalingContext = logic.createContext(cpu, resource) - every { resource.speed.value } returns 1400.0 + every { resource.speed } returns 1400.0 scalingContext.setTarget(1400.0) assertEquals(150.0, logic.computePower()) - every { resource.speed.value } returns 1400.0 + every { resource.speed } returns 1400.0 scalingContext.setTarget(4000.0) assertEquals(235.0, logic.computePower()) } |
