summaryrefslogtreecommitdiff
path: root/opendc-simulator/opendc-simulator-flow/src
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2022-10-05 14:44:43 +0200
committerGitHub <noreply@github.com>2022-10-05 14:44:43 +0200
commitc2047d09b27b0c05f5c203509dde524e17d3b729 (patch)
tree3903d8aed5e87850c92e1b2dce8379ea99bdfa6d /opendc-simulator/opendc-simulator-flow/src
parentec3b5b462c1b8296ba18a3872f56d569fa70e45b (diff)
parentbe176910eb870209576326ffaad8bf21241fccbd (diff)
merge: Extract scheduler from simulation coroutine dispatcher (#106)
This pull request extracts the scheduler from the `SimulationCoroutineDispatcher` into a separate `SimulationScheduler` class which allows users to re-use the scheduler between different coroutine dispatchers. We implement the `SimulationScheduler` in Java, removing the explicit dependency on Kotlin or `kotlinx-coroutines`. The scheduler uses a separate specialized priority queue implementation that eliminates allocation in the hot path of the simulator. ## Implementation Notes :hammer_and_pick: * Add Java-based simulator core * Use SimulationScheduler in coroutine dispatcher * Rename runBlockingSimulation to runSimulation ## External Dependencies :four_leaf_clover: * N/A ## Breaking API Changes :warning: * The Kotlin API for simulation has been moved to `org.opendc.simulator.kotlin`. * `runBlockingSImulation` renamed to `runSimulation`
Diffstat (limited to 'opendc-simulator/opendc-simulator-flow/src')
-rw-r--r--opendc-simulator/opendc-simulator-flow/src/jmh/kotlin/org/opendc/simulator/flow/FlowBenchmarks.kt22
-rw-r--r--opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/FlowConsumerContextTest.kt8
-rw-r--r--opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/FlowForwarderTest.kt28
-rw-r--r--opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/FlowSinkTest.kt22
-rw-r--r--opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/mux/ForwardingFlowMultiplexerTest.kt10
-rw-r--r--opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/mux/MaxMinFlowMultiplexerTest.kt8
-rw-r--r--opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/source/FixedFlowSourceTest.kt6
7 files changed, 52 insertions, 52 deletions
diff --git a/opendc-simulator/opendc-simulator-flow/src/jmh/kotlin/org/opendc/simulator/flow/FlowBenchmarks.kt b/opendc-simulator/opendc-simulator-flow/src/jmh/kotlin/org/opendc/simulator/flow/FlowBenchmarks.kt
index aabd2220..86fbe8e4 100644
--- a/opendc-simulator/opendc-simulator-flow/src/jmh/kotlin/org/opendc/simulator/flow/FlowBenchmarks.kt
+++ b/opendc-simulator/opendc-simulator-flow/src/jmh/kotlin/org/opendc/simulator/flow/FlowBenchmarks.kt
@@ -24,10 +24,10 @@ package org.opendc.simulator.flow
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.launch
-import org.opendc.simulator.core.runBlockingSimulation
import org.opendc.simulator.flow.mux.ForwardingFlowMultiplexer
import org.opendc.simulator.flow.mux.MaxMinFlowMultiplexer
import org.opendc.simulator.flow.source.TraceFlowSource
+import org.opendc.simulator.kotlin.runSimulation
import org.openjdk.jmh.annotations.*
import java.util.concurrent.ThreadLocalRandom
import java.util.concurrent.TimeUnit
@@ -49,27 +49,27 @@ class FlowBenchmarks {
@Benchmark
fun benchmarkSink() {
- return runBlockingSimulation {
+ return runSimulation {
val engine = FlowEngine(coroutineContext, clock)
val provider = FlowSink(engine, 4200.0)
- return@runBlockingSimulation provider.consume(TraceFlowSource(trace))
+ return@runSimulation provider.consume(TraceFlowSource(trace))
}
}
@Benchmark
fun benchmarkForward() {
- return runBlockingSimulation {
+ return runSimulation {
val engine = FlowEngine(coroutineContext, clock)
val provider = FlowSink(engine, 4200.0)
val forwarder = FlowForwarder(engine)
provider.startConsumer(forwarder)
- return@runBlockingSimulation forwarder.consume(TraceFlowSource(trace))
+ return@runSimulation forwarder.consume(TraceFlowSource(trace))
}
}
@Benchmark
fun benchmarkMuxMaxMinSingleSource() {
- return runBlockingSimulation {
+ return runSimulation {
val engine = FlowEngine(coroutineContext, clock)
val switch = MaxMinFlowMultiplexer(engine)
@@ -77,13 +77,13 @@ class FlowBenchmarks {
FlowSink(engine, 3000.0).startConsumer(switch.newOutput())
val provider = switch.newInput()
- return@runBlockingSimulation provider.consume(TraceFlowSource(trace))
+ return@runSimulation provider.consume(TraceFlowSource(trace))
}
}
@Benchmark
fun benchmarkMuxMaxMinTripleSource() {
- return runBlockingSimulation {
+ return runSimulation {
val engine = FlowEngine(coroutineContext, clock)
val switch = MaxMinFlowMultiplexer(engine)
@@ -101,7 +101,7 @@ class FlowBenchmarks {
@Benchmark
fun benchmarkMuxExclusiveSingleSource() {
- return runBlockingSimulation {
+ return runSimulation {
val engine = FlowEngine(coroutineContext, clock)
val switch = ForwardingFlowMultiplexer(engine)
@@ -109,13 +109,13 @@ class FlowBenchmarks {
FlowSink(engine, 3000.0).startConsumer(switch.newOutput())
val provider = switch.newInput()
- return@runBlockingSimulation provider.consume(TraceFlowSource(trace))
+ return@runSimulation provider.consume(TraceFlowSource(trace))
}
}
@Benchmark
fun benchmarkMuxExclusiveTripleSource() {
- return runBlockingSimulation {
+ return runSimulation {
val engine = FlowEngine(coroutineContext, clock)
val switch = ForwardingFlowMultiplexer(engine)
diff --git a/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/FlowConsumerContextTest.kt b/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/FlowConsumerContextTest.kt
index e7b25554..d782d036 100644
--- a/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/FlowConsumerContextTest.kt
+++ b/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/FlowConsumerContextTest.kt
@@ -24,16 +24,16 @@ package org.opendc.simulator.flow
import io.mockk.*
import org.junit.jupiter.api.*
-import org.opendc.simulator.core.runBlockingSimulation
import org.opendc.simulator.flow.internal.FlowConsumerContextImpl
import org.opendc.simulator.flow.internal.FlowEngineImpl
+import org.opendc.simulator.kotlin.runSimulation
/**
* A test suite for the [FlowConsumerContextImpl] class.
*/
class FlowConsumerContextTest {
@Test
- fun testFlushWithoutCommand() = runBlockingSimulation {
+ fun testFlushWithoutCommand() = runSimulation {
val engine = FlowEngineImpl(coroutineContext, clock)
val consumer = object : FlowSource {
override fun onPull(conn: FlowConnection, now: Long): Long {
@@ -54,7 +54,7 @@ class FlowConsumerContextTest {
}
@Test
- fun testDoubleStart() = runBlockingSimulation {
+ fun testDoubleStart() = runSimulation {
val engine = FlowEngineImpl(coroutineContext, clock)
val consumer = object : FlowSource {
override fun onPull(conn: FlowConnection, now: Long): Long {
@@ -79,7 +79,7 @@ class FlowConsumerContextTest {
}
@Test
- fun testIdempotentCapacityChange() = runBlockingSimulation {
+ fun testIdempotentCapacityChange() = runSimulation {
val engine = FlowEngineImpl(coroutineContext, clock)
val consumer = spyk(object : FlowSource {
override fun onPull(conn: FlowConnection, now: Long): Long {
diff --git a/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/FlowForwarderTest.kt b/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/FlowForwarderTest.kt
index 8b090593..2025dd52 100644
--- a/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/FlowForwarderTest.kt
+++ b/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/FlowForwarderTest.kt
@@ -28,16 +28,16 @@ import org.junit.jupiter.api.Assertions.*
import org.junit.jupiter.api.Disabled
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.assertThrows
-import org.opendc.simulator.core.runBlockingSimulation
import org.opendc.simulator.flow.internal.FlowEngineImpl
import org.opendc.simulator.flow.source.FixedFlowSource
+import org.opendc.simulator.kotlin.runSimulation
/**
* A test suite for the [FlowForwarder] class.
*/
internal class FlowForwarderTest {
@Test
- fun testCancelImmediately() = runBlockingSimulation {
+ fun testCancelImmediately() = runSimulation {
val engine = FlowEngineImpl(coroutineContext, clock)
val forwarder = FlowForwarder(engine)
val source = FlowSink(engine, 2000.0)
@@ -56,7 +56,7 @@ internal class FlowForwarderTest {
}
@Test
- fun testCancel() = runBlockingSimulation {
+ fun testCancel() = runSimulation {
val engine = FlowEngineImpl(coroutineContext, clock)
val forwarder = FlowForwarder(engine)
val source = FlowSink(engine, 2000.0)
@@ -83,7 +83,7 @@ internal class FlowForwarderTest {
}
@Test
- fun testState() = runBlockingSimulation {
+ fun testState() = runSimulation {
val engine = FlowEngineImpl(coroutineContext, clock)
val forwarder = FlowForwarder(engine)
val consumer = object : FlowSource {
@@ -108,7 +108,7 @@ internal class FlowForwarderTest {
}
@Test
- fun testCancelPendingDelegate() = runBlockingSimulation {
+ fun testCancelPendingDelegate() = runSimulation {
val engine = FlowEngineImpl(coroutineContext, clock)
val forwarder = FlowForwarder(engine)
@@ -126,7 +126,7 @@ internal class FlowForwarderTest {
}
@Test
- fun testCancelStartedDelegate() = runBlockingSimulation {
+ fun testCancelStartedDelegate() = runSimulation {
val engine = FlowEngineImpl(coroutineContext, clock)
val forwarder = FlowForwarder(engine)
val source = FlowSink(engine, 2000.0)
@@ -144,7 +144,7 @@ internal class FlowForwarderTest {
}
@Test
- fun testCancelPropagation() = runBlockingSimulation {
+ fun testCancelPropagation() = runSimulation {
val engine = FlowEngineImpl(coroutineContext, clock)
val forwarder = FlowForwarder(engine)
val source = FlowSink(engine, 2000.0)
@@ -162,7 +162,7 @@ internal class FlowForwarderTest {
}
@Test
- fun testExitPropagation() = runBlockingSimulation {
+ fun testExitPropagation() = runSimulation {
val engine = FlowEngineImpl(coroutineContext, clock)
val forwarder = FlowForwarder(engine, isCoupled = true)
val source = FlowSink(engine, 2000.0)
@@ -183,7 +183,7 @@ internal class FlowForwarderTest {
@Test
@Disabled // Due to Kotlin bug: https://github.com/mockk/mockk/issues/368
- fun testAdjustCapacity() = runBlockingSimulation {
+ fun testAdjustCapacity() = runSimulation {
val engine = FlowEngineImpl(coroutineContext, clock)
val forwarder = FlowForwarder(engine)
val sink = FlowSink(engine, 1.0)
@@ -202,7 +202,7 @@ internal class FlowForwarderTest {
}
@Test
- fun testCounters() = runBlockingSimulation {
+ fun testCounters() = runSimulation {
val engine = FlowEngineImpl(coroutineContext, clock)
val forwarder = FlowForwarder(engine)
val source = FlowSink(engine, 1.0)
@@ -224,7 +224,7 @@ internal class FlowForwarderTest {
}
@Test
- fun testCoupledExit() = runBlockingSimulation {
+ fun testCoupledExit() = runSimulation {
val engine = FlowEngineImpl(coroutineContext, clock)
val forwarder = FlowForwarder(engine, isCoupled = true)
val source = FlowSink(engine, 2000.0)
@@ -239,7 +239,7 @@ internal class FlowForwarderTest {
}
@Test
- fun testPullFailureCoupled() = runBlockingSimulation {
+ fun testPullFailureCoupled() = runSimulation {
val engine = FlowEngineImpl(coroutineContext, clock)
val forwarder = FlowForwarder(engine, isCoupled = true)
val source = FlowSink(engine, 2000.0)
@@ -262,7 +262,7 @@ internal class FlowForwarderTest {
}
@Test
- fun testStartFailure() = runBlockingSimulation {
+ fun testStartFailure() = runSimulation {
val engine = FlowEngineImpl(coroutineContext, clock)
val forwarder = FlowForwarder(engine)
val source = FlowSink(engine, 2000.0)
@@ -290,7 +290,7 @@ internal class FlowForwarderTest {
}
@Test
- fun testConvergeFailure() = runBlockingSimulation {
+ fun testConvergeFailure() = runSimulation {
val engine = FlowEngineImpl(coroutineContext, clock)
val forwarder = FlowForwarder(engine)
val source = FlowSink(engine, 2000.0)
diff --git a/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/FlowSinkTest.kt b/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/FlowSinkTest.kt
index 726ddbf7..22a84edb 100644
--- a/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/FlowSinkTest.kt
+++ b/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/FlowSinkTest.kt
@@ -27,17 +27,17 @@ import io.mockk.verify
import kotlinx.coroutines.*
import org.junit.jupiter.api.*
import org.junit.jupiter.api.Assertions.assertEquals
-import org.opendc.simulator.core.runBlockingSimulation
import org.opendc.simulator.flow.internal.FlowEngineImpl
import org.opendc.simulator.flow.source.FixedFlowSource
import org.opendc.simulator.flow.source.FlowSourceRateAdapter
+import org.opendc.simulator.kotlin.runSimulation
/**
* A test suite for the [FlowSink] class.
*/
internal class FlowSinkTest {
@Test
- fun testSpeed() = runBlockingSimulation {
+ fun testSpeed() = runSimulation {
val engine = FlowEngineImpl(coroutineContext, clock)
val capacity = 4200.0
val provider = FlowSink(engine, capacity)
@@ -53,7 +53,7 @@ internal class FlowSinkTest {
}
@Test
- fun testAdjustCapacity() = runBlockingSimulation {
+ fun testAdjustCapacity() = runSimulation {
val engine = FlowEngineImpl(coroutineContext, clock)
val provider = FlowSink(engine, 1.0)
@@ -69,7 +69,7 @@ internal class FlowSinkTest {
}
@Test
- fun testSpeedLimit() = runBlockingSimulation {
+ fun testSpeedLimit() = runSimulation {
val engine = FlowEngineImpl(coroutineContext, clock)
val capacity = 4200.0
val provider = FlowSink(engine, capacity)
@@ -89,7 +89,7 @@ internal class FlowSinkTest {
* [FlowSource.onPull].
*/
@Test
- fun testIntermediateInterrupt() = runBlockingSimulation {
+ fun testIntermediateInterrupt() = runSimulation {
val engine = FlowEngineImpl(coroutineContext, clock)
val capacity = 4200.0
val provider = FlowSink(engine, capacity)
@@ -109,7 +109,7 @@ internal class FlowSinkTest {
}
@Test
- fun testInterrupt() = runBlockingSimulation {
+ fun testInterrupt() = runSimulation {
val engine = FlowEngineImpl(coroutineContext, clock)
val capacity = 4200.0
val provider = FlowSink(engine, capacity)
@@ -144,7 +144,7 @@ internal class FlowSinkTest {
}
@Test
- fun testFailure() = runBlockingSimulation {
+ fun testFailure() = runSimulation {
val engine = FlowEngineImpl(coroutineContext, clock)
val capacity = 4200.0
val provider = FlowSink(engine, capacity)
@@ -165,7 +165,7 @@ internal class FlowSinkTest {
}
@Test
- fun testExceptionPropagationOnNext() = runBlockingSimulation {
+ fun testExceptionPropagationOnNext() = runSimulation {
val engine = FlowEngineImpl(coroutineContext, clock)
val capacity = 4200.0
val provider = FlowSink(engine, capacity)
@@ -190,7 +190,7 @@ internal class FlowSinkTest {
}
@Test
- fun testConcurrentConsumption() = runBlockingSimulation {
+ fun testConcurrentConsumption() = runSimulation {
val engine = FlowEngineImpl(coroutineContext, clock)
val capacity = 4200.0
val provider = FlowSink(engine, capacity)
@@ -206,7 +206,7 @@ internal class FlowSinkTest {
}
@Test
- fun testCancelDuringConsumption() = runBlockingSimulation {
+ fun testCancelDuringConsumption() = runSimulation {
val engine = FlowEngineImpl(coroutineContext, clock)
val capacity = 4200.0
val provider = FlowSink(engine, capacity)
@@ -225,7 +225,7 @@ internal class FlowSinkTest {
@Test
fun testInfiniteSleep() {
assertThrows<IllegalStateException> {
- runBlockingSimulation {
+ runSimulation {
val engine = FlowEngineImpl(coroutineContext, clock)
val capacity = 4200.0
val provider = FlowSink(engine, capacity)
diff --git a/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/mux/ForwardingFlowMultiplexerTest.kt b/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/mux/ForwardingFlowMultiplexerTest.kt
index ef15f711..cfd2bdf0 100644
--- a/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/mux/ForwardingFlowMultiplexerTest.kt
+++ b/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/mux/ForwardingFlowMultiplexerTest.kt
@@ -27,12 +27,12 @@ import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.assertAll
import org.junit.jupiter.api.assertThrows
-import org.opendc.simulator.core.runBlockingSimulation
import org.opendc.simulator.flow.*
import org.opendc.simulator.flow.internal.FlowEngineImpl
import org.opendc.simulator.flow.source.FixedFlowSource
import org.opendc.simulator.flow.source.FlowSourceRateAdapter
import org.opendc.simulator.flow.source.TraceFlowSource
+import org.opendc.simulator.kotlin.runSimulation
/**
* Test suite for the [ForwardingFlowMultiplexer] class.
@@ -42,7 +42,7 @@ internal class ForwardingFlowMultiplexerTest {
* Test a trace workload.
*/
@Test
- fun testTrace() = runBlockingSimulation {
+ fun testTrace() = runSimulation {
val engine = FlowEngineImpl(coroutineContext, clock)
val speed = mutableListOf<Double>()
@@ -79,7 +79,7 @@ internal class ForwardingFlowMultiplexerTest {
* Test runtime workload on hypervisor.
*/
@Test
- fun testRuntimeWorkload() = runBlockingSimulation {
+ fun testRuntimeWorkload() = runSimulation {
val engine = FlowEngineImpl(coroutineContext, clock)
val duration = 5 * 60L * 1000
@@ -101,7 +101,7 @@ internal class ForwardingFlowMultiplexerTest {
* Test two workloads running sequentially.
*/
@Test
- fun testTwoWorkloads() = runBlockingSimulation {
+ fun testTwoWorkloads() = runSimulation {
val engine = FlowEngineImpl(coroutineContext, clock)
val duration = 5 * 60L * 1000
@@ -140,7 +140,7 @@ internal class ForwardingFlowMultiplexerTest {
* Test concurrent workloads on the machine.
*/
@Test
- fun testConcurrentWorkloadFails() = runBlockingSimulation {
+ fun testConcurrentWorkloadFails() = runSimulation {
val engine = FlowEngineImpl(coroutineContext, clock)
val switch = ForwardingFlowMultiplexer(engine)
diff --git a/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/mux/MaxMinFlowMultiplexerTest.kt b/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/mux/MaxMinFlowMultiplexerTest.kt
index 6e2cdb98..4e242292 100644
--- a/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/mux/MaxMinFlowMultiplexerTest.kt
+++ b/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/mux/MaxMinFlowMultiplexerTest.kt
@@ -27,19 +27,19 @@ import kotlinx.coroutines.launch
import kotlinx.coroutines.yield
import org.junit.jupiter.api.*
import org.junit.jupiter.api.Assertions.assertEquals
-import org.opendc.simulator.core.runBlockingSimulation
import org.opendc.simulator.flow.FlowSink
import org.opendc.simulator.flow.consume
import org.opendc.simulator.flow.internal.FlowEngineImpl
import org.opendc.simulator.flow.source.FixedFlowSource
import org.opendc.simulator.flow.source.TraceFlowSource
+import org.opendc.simulator.kotlin.runSimulation
/**
* Test suite for the [FlowMultiplexer] implementations
*/
internal class MaxMinFlowMultiplexerTest {
@Test
- fun testSmoke() = runBlockingSimulation {
+ fun testSmoke() = runSimulation {
val scheduler = FlowEngineImpl(coroutineContext, clock)
val switch = MaxMinFlowMultiplexer(scheduler)
@@ -61,7 +61,7 @@ internal class MaxMinFlowMultiplexerTest {
* Test overcommitting of resources via the hypervisor with a single VM.
*/
@Test
- fun testOvercommittedSingle() = runBlockingSimulation {
+ fun testOvercommittedSingle() = runSimulation {
val scheduler = FlowEngineImpl(coroutineContext, clock)
val duration = 5 * 60L
@@ -99,7 +99,7 @@ internal class MaxMinFlowMultiplexerTest {
* Test overcommitting of resources via the hypervisor with two VMs.
*/
@Test
- fun testOvercommittedDual() = runBlockingSimulation {
+ fun testOvercommittedDual() = runSimulation {
val scheduler = FlowEngineImpl(coroutineContext, clock)
val duration = 5 * 60L
diff --git a/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/source/FixedFlowSourceTest.kt b/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/source/FixedFlowSourceTest.kt
index 8396d346..552579ff 100644
--- a/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/source/FixedFlowSourceTest.kt
+++ b/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/source/FixedFlowSourceTest.kt
@@ -24,17 +24,17 @@ package org.opendc.simulator.flow.source
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Test
-import org.opendc.simulator.core.runBlockingSimulation
import org.opendc.simulator.flow.FlowSink
import org.opendc.simulator.flow.consume
import org.opendc.simulator.flow.internal.FlowEngineImpl
+import org.opendc.simulator.kotlin.runSimulation
/**
* A test suite for the [FixedFlowSource] class.
*/
internal class FixedFlowSourceTest {
@Test
- fun testSmoke() = runBlockingSimulation {
+ fun testSmoke() = runSimulation {
val scheduler = FlowEngineImpl(coroutineContext, clock)
val provider = FlowSink(scheduler, 1.0)
@@ -45,7 +45,7 @@ internal class FixedFlowSourceTest {
}
@Test
- fun testUtilization() = runBlockingSimulation {
+ fun testUtilization() = runSimulation {
val scheduler = FlowEngineImpl(coroutineContext, clock)
val provider = FlowSink(scheduler, 1.0)