summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--opendc-core/src/main/kotlin/nl/atlarge/opendc/simulator/omega/OmegaSimulator.kt10
-rw-r--r--opendc-core/src/test/kotlin/nl/atlarge/opendc/SmokeTest.kt2
2 files changed, 7 insertions, 5 deletions
diff --git a/opendc-core/src/main/kotlin/nl/atlarge/opendc/simulator/omega/OmegaSimulator.kt b/opendc-core/src/main/kotlin/nl/atlarge/opendc/simulator/omega/OmegaSimulator.kt
index 6b7407e5..764134e5 100644
--- a/opendc-core/src/main/kotlin/nl/atlarge/opendc/simulator/omega/OmegaSimulator.kt
+++ b/opendc-core/src/main/kotlin/nl/atlarge/opendc/simulator/omega/OmegaSimulator.kt
@@ -121,13 +121,15 @@ class OmegaSimulator(override val topology: Topology): Simulator, Iterator<Unit>
while (true) {
val (tick, block) = clock.queue.peek() ?: return
- if (tick > clock.tick)
+ if (tick > clock.tick) {
// Tick has yet to occur
+ // Jump in time to next event
+ clock.tick = tick - 1
break
- else if (tick < clock.tick)
+ } else if (tick < clock.tick) {
// Tick has already occurred
- logger.warn {"tick was not handled correctly"}
-
+ logger.warn { "tick was not handled correctly" }
+ }
clock.queue.poll()
block()
}
diff --git a/opendc-core/src/test/kotlin/nl/atlarge/opendc/SmokeTest.kt b/opendc-core/src/test/kotlin/nl/atlarge/opendc/SmokeTest.kt
index 7d3c317e..50e22734 100644
--- a/opendc-core/src/test/kotlin/nl/atlarge/opendc/SmokeTest.kt
+++ b/opendc-core/src/test/kotlin/nl/atlarge/opendc/SmokeTest.kt
@@ -37,7 +37,7 @@ internal class SmokeTest {
val builder = AdjacencyListTopologyBuilder()
val topology = builder.build().apply {
val rack = node(Rack())
- val n = 1000000
+ val n = 100
// Create n machines in the rack
repeat(n) {
val machine = node(Machine())