summaryrefslogtreecommitdiff
path: root/opendc-compute/opendc-compute-simulator
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2021-10-08 22:02:07 +0200
committerGitHub <noreply@github.com>2021-10-08 22:02:07 +0200
commitb7a71e5b4aa77b41ef41deec2ace42b67a5a13a7 (patch)
treeb88bbede15108c6855d7f94ded4c7054df186a72 /opendc-compute/opendc-compute-simulator
parent3098eeb116a80ce12e6575e454d0448867478792 (diff)
parente2f002358e9d5be2239fa2cb7ca92c9c96a21b6f (diff)
merge: Performance improvements for flow engine
This pull request applies multiple performance improvements for the flow engine and compute simulator. * Optimize SimTraceWorkload (by storing fragments using several arrays) * Skip fair-share algorithm if capacity remaining * Count interference for multiplexer inputs * Simplify FlowSink implementation * Do not update outputs if rate is unchanged * Eliminate ArrayList iteration overhead * Optimize clock storage * Specialize FlowEngine queues * Eliminate clock access in hot path **Breaking API Changes** * `SimTraceWorkload` now accepts a `SimTrace` as parameter. This trace can be constructed using fragments or directly using builder class. Internally, the trace is now stored using several arrays.
Diffstat (limited to 'opendc-compute/opendc-compute-simulator')
-rw-r--r--opendc-compute/opendc-compute-simulator/src/test/kotlin/org/opendc/compute/simulator/SimHostTest.kt32
1 files changed, 17 insertions, 15 deletions
diff --git a/opendc-compute/opendc-compute-simulator/src/test/kotlin/org/opendc/compute/simulator/SimHostTest.kt b/opendc-compute/opendc-compute-simulator/src/test/kotlin/org/opendc/compute/simulator/SimHostTest.kt
index 26089b6d..a0ff9228 100644
--- a/opendc-compute/opendc-compute-simulator/src/test/kotlin/org/opendc/compute/simulator/SimHostTest.kt
+++ b/opendc-compute/opendc-compute-simulator/src/test/kotlin/org/opendc/compute/simulator/SimHostTest.kt
@@ -39,6 +39,8 @@ import org.opendc.simulator.compute.model.MachineModel
import org.opendc.simulator.compute.model.MemoryUnit
import org.opendc.simulator.compute.model.ProcessingNode
import org.opendc.simulator.compute.model.ProcessingUnit
+import org.opendc.simulator.compute.workload.SimTrace
+import org.opendc.simulator.compute.workload.SimTraceFragment
import org.opendc.simulator.compute.workload.SimTraceWorkload
import org.opendc.simulator.core.runBlockingSimulation
import org.opendc.simulator.flow.FlowEngine
@@ -105,11 +107,11 @@ internal class SimHostTest {
emptyMap(),
mapOf(
"workload" to SimTraceWorkload(
- sequenceOf(
- SimTraceWorkload.Fragment(0, duration * 1000, 2 * 28.0, 2),
- SimTraceWorkload.Fragment(duration * 1000, duration * 1000, 2 * 3500.0, 2),
- SimTraceWorkload.Fragment(duration * 2000, duration * 1000, 0.0, 2),
- SimTraceWorkload.Fragment(duration * 3000, duration * 1000, 2 * 183.0, 2)
+ SimTrace.ofFragments(
+ SimTraceFragment(0, duration * 1000, 2 * 28.0, 2),
+ SimTraceFragment(duration * 1000, duration * 1000, 2 * 3500.0, 2),
+ SimTraceFragment(duration * 2000, duration * 1000, 0.0, 2),
+ SimTraceFragment(duration * 3000, duration * 1000, 2 * 183.0, 2)
),
offset = 1
)
@@ -121,11 +123,11 @@ internal class SimHostTest {
emptyMap(),
mapOf(
"workload" to SimTraceWorkload(
- sequenceOf(
- SimTraceWorkload.Fragment(0, duration * 1000, 2 * 28.0, 2),
- SimTraceWorkload.Fragment(duration * 1000, duration * 1000, 2 * 3100.0, 2),
- SimTraceWorkload.Fragment(duration * 2000, duration * 1000, 0.0, 2),
- SimTraceWorkload.Fragment(duration * 3000, duration * 1000, 2 * 73.0, 2)
+ SimTrace.ofFragments(
+ SimTraceFragment(0, duration * 1000, 2 * 28.0, 2),
+ SimTraceFragment(duration * 1000, duration * 1000, 2 * 3100.0, 2),
+ SimTraceFragment(duration * 2000, duration * 1000, 0.0, 2),
+ SimTraceFragment(duration * 3000, duration * 1000, 2 * 73.0, 2)
),
offset = 1
)
@@ -217,11 +219,11 @@ internal class SimHostTest {
emptyMap(),
mapOf(
"workload" to SimTraceWorkload(
- sequenceOf(
- SimTraceWorkload.Fragment(0, duration * 1000, 2 * 28.0, 2),
- SimTraceWorkload.Fragment(duration * 1000L, duration * 1000, 2 * 3500.0, 2),
- SimTraceWorkload.Fragment(duration * 2000L, duration * 1000, 0.0, 2),
- SimTraceWorkload.Fragment(duration * 3000L, duration * 1000, 2 * 183.0, 2)
+ SimTrace.ofFragments(
+ SimTraceFragment(0, duration * 1000, 2 * 28.0, 2),
+ SimTraceFragment(duration * 1000L, duration * 1000, 2 * 3500.0, 2),
+ SimTraceFragment(duration * 2000L, duration * 1000, 0.0, 2),
+ SimTraceFragment(duration * 3000L, duration * 1000, 2 * 183.0, 2)
),
offset = 1
)