summaryrefslogtreecommitdiff
path: root/simulator/buildSrc/src
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2021-03-23 11:56:53 +0100
committerGitHub <noreply@github.com>2021-03-23 11:56:53 +0100
commit6de1ef7424e058603be9ae5a86f0568b40579e5f (patch)
tree2a882a67667e8efcd51d74cfbe32fdeaad02f502 /simulator/buildSrc/src
parent0fa1dc262905c42b3549172fea59f7ad4cb58b1f (diff)
parent38a13e5c201c828f9f21f17e89916b4638396945 (diff)
simulator: Add uniform resource consumption model (v2)
This is the second pull request in the series of pull requests to add a uniform resource consumption model to OpenDC. This pull request focusses on adding dynamic capacity negotiation and propagation between resource consumer and resource provider: * The generic resource constraint is removed from the interfaces of `opendc-simulator-resources`. Users of the API are expected to use the untyped variants where only the capacity needs to be specified. Users are expected to build higher-level abstractions on top of these interface to represent actual resources (e.g., CPU, disk or network). * Added benchmarks for the most important implementations of `opendc-simulator-resources`. This allows us to quantify the effects of changes on the runtime. * The `SimResourceSwitchMaxMin` has been split into a `SimResourceAggregatorMaxMin` and `SimResourceDistributorMaxMin` which respectively aggregate input resources and distribute output resources using max-min fair sharing. * The `SimResourceConsumer` interface has a new method for receiving capacity change events: `onCapacityChanged(ctx, isThrottled)` **Breaking API Changes** * All interfaces in `opendc-simulator-resources`.
Diffstat (limited to 'simulator/buildSrc/src')
-rw-r--r--simulator/buildSrc/src/main/kotlin/benchmark-conventions.gradle.kts60
1 files changed, 60 insertions, 0 deletions
diff --git a/simulator/buildSrc/src/main/kotlin/benchmark-conventions.gradle.kts b/simulator/buildSrc/src/main/kotlin/benchmark-conventions.gradle.kts
new file mode 100644
index 00000000..d3bb886d
--- /dev/null
+++ b/simulator/buildSrc/src/main/kotlin/benchmark-conventions.gradle.kts
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2021 AtLarge Research
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+import kotlinx.benchmark.gradle.*
+import org.jetbrains.kotlin.allopen.gradle.*
+
+plugins {
+ id("org.jetbrains.kotlinx.benchmark")
+ `java-library`
+ kotlin("plugin.allopen")
+}
+
+sourceSets {
+ register("jmh") {
+ compileClasspath += sourceSets["main"].output
+ runtimeClasspath += sourceSets["main"].output
+ }
+}
+
+configurations {
+ named("jmhImplementation") {
+ extendsFrom(configurations["implementation"])
+ }
+}
+
+configure<AllOpenExtension> {
+ annotation("org.openjdk.jmh.annotations.State")
+}
+
+benchmark {
+ targets {
+ register("jmh") {
+ this as JvmBenchmarkTarget
+ jmhVersion = "1.21"
+ }
+ }
+}
+
+dependencies {
+ implementation("org.jetbrains.kotlinx:kotlinx-benchmark-runtime-jvm:0.3.0")
+}