summaryrefslogtreecommitdiff
path: root/opendc-simulator/opendc-simulator-resources/src/test
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2021-09-29 16:52:30 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2021-10-03 17:17:37 +0200
commit657deac134f7b9ee30ed7e2b7667e30f3b17f79f (patch)
treeb778567ac2c07a7bc459a10a50d0036641a1db41 /opendc-simulator/opendc-simulator-resources/src/test
parent02fa44c0b116ff51c4cbe2876d8b2a225ed68553 (diff)
perf(simulator): Reduce memory allocations in SimResourceInterpreter
This change removes unnecessary allocations in the SimResourceInterpreter caused by the way timers were allocated for the resource context.
Diffstat (limited to 'opendc-simulator/opendc-simulator-resources/src/test')
-rw-r--r--opendc-simulator/opendc-simulator-resources/src/test/kotlin/org/opendc/simulator/resources/SimResourceContextTest.kt4
1 files changed, 2 insertions, 2 deletions
diff --git a/opendc-simulator/opendc-simulator-resources/src/test/kotlin/org/opendc/simulator/resources/SimResourceContextTest.kt b/opendc-simulator/opendc-simulator-resources/src/test/kotlin/org/opendc/simulator/resources/SimResourceContextTest.kt
index 4e57f598..e95e9e42 100644
--- a/opendc-simulator/opendc-simulator-resources/src/test/kotlin/org/opendc/simulator/resources/SimResourceContextTest.kt
+++ b/opendc-simulator/opendc-simulator-resources/src/test/kotlin/org/opendc/simulator/resources/SimResourceContextTest.kt
@@ -51,7 +51,7 @@ class SimResourceContextTest {
val logic = object : SimResourceProviderLogic {}
val context = SimResourceContextImpl(null, interpreter, consumer, logic)
- context.doUpdate(interpreter.clock.millis())
+ interpreter.scheduleSync(interpreter.clock.millis(), context)
}
@Test
@@ -77,7 +77,7 @@ class SimResourceContextTest {
context.start()
delay(1) // Delay 1 ms to prevent hitting the fast path
- context.doUpdate(interpreter.clock.millis())
+ interpreter.scheduleSync(interpreter.clock.millis(), context)
verify(exactly = 2) { logic.onConsume(any(), any(), any(), any()) }
}