From 766b41566f4cf8297202147d789e135a76041ed4 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Sun, 22 Aug 2021 13:21:53 +0200 Subject: perf(simulator): Prevent counter update without work This change implements a performance improvement by preventing updates on the resource counters in case no work was performed in the last cycle. --- .../org/opendc/simulator/resources/SimAbstractResourceProvider.kt | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'opendc-simulator') diff --git a/opendc-simulator/opendc-simulator-resources/src/main/kotlin/org/opendc/simulator/resources/SimAbstractResourceProvider.kt b/opendc-simulator/opendc-simulator-resources/src/main/kotlin/org/opendc/simulator/resources/SimAbstractResourceProvider.kt index c1b1450e..2ceb1e3c 100644 --- a/opendc-simulator/opendc-simulator-resources/src/main/kotlin/org/opendc/simulator/resources/SimAbstractResourceProvider.kt +++ b/opendc-simulator/opendc-simulator-resources/src/main/kotlin/org/opendc/simulator/resources/SimAbstractResourceProvider.kt @@ -88,6 +88,10 @@ public abstract class SimAbstractResourceProvider( * Update the counters of the resource provider. */ protected fun updateCounters(ctx: SimResourceContext, work: Double) { + if (work <= 0.0) { + return + } + val counters = _counters val remainingWork = ctx.remainingWork counters.demand += work -- cgit v1.2.3 From b8f64c1d3df2c990df8941cd036222fab2def9fa Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Sun, 22 Aug 2021 13:23:53 +0200 Subject: refactor(compute): Update FilterScheduler to follow OpenStack's Nova This change updates the FilterScheduler implementation to follow more closely the scheduler implementation in OpenStack's Nova. We now normalize the weights, support many of the filters and weights in OpenStack and support overcommitting resources. --- .../org/opendc/simulator/resources/SimAbstractResourceProvider.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'opendc-simulator') diff --git a/opendc-simulator/opendc-simulator-resources/src/main/kotlin/org/opendc/simulator/resources/SimAbstractResourceProvider.kt b/opendc-simulator/opendc-simulator-resources/src/main/kotlin/org/opendc/simulator/resources/SimAbstractResourceProvider.kt index 2ceb1e3c..860c50ee 100644 --- a/opendc-simulator/opendc-simulator-resources/src/main/kotlin/org/opendc/simulator/resources/SimAbstractResourceProvider.kt +++ b/opendc-simulator/opendc-simulator-resources/src/main/kotlin/org/opendc/simulator/resources/SimAbstractResourceProvider.kt @@ -89,7 +89,7 @@ public abstract class SimAbstractResourceProvider( */ protected fun updateCounters(ctx: SimResourceContext, work: Double) { if (work <= 0.0) { - return + return } val counters = _counters -- cgit v1.2.3