summaryrefslogtreecommitdiff
path: root/simulator/opendc-runner-web/src
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2021-03-17 16:51:38 +0100
committerGitHub <noreply@github.com>2021-03-17 16:51:38 +0100
commit054a3d376b8b31ba98f91e7b34c6e0ca717def18 (patch)
treeee739cf4092a2b807e0043bed7cae72cff7b6bac /simulator/opendc-runner-web/src
parentdf2f52780c08c5d108741d3746eaf03222c64841 (diff)
parentbb3b8e207a08edff81b8c2fe30b476c94bfea086 (diff)
Add uniform resource consumption model (v1)
This is the first in the series of pull requests to add a uniform resource consumption model to OpenDC. This pull request introduces the `opendc-simulator-resources` module which introduces the primitives with which we can model resource consumption of CPUs, disks and network: * `SimResourceProvider` represents a provider of some generic resource `R`, which may be consumed via `consume(SimResourceConsumer<R>)` * `SimResourceConsumer` represents a resource consumers and characterizes how the resource is being consumed. * `SimResourceSwitch` is a generic scheduler for sharing the capacity of multiple resources across multiple consumers. - `SimResourceSwitchExclusive`: A space-shared switch - each consumer is allocated a single resource exclusively. - `SimResourceSwitchMinMax`: A time-shared switch - each consumer gets a fair share of the resource capacity. * `SimResourceForwarder` converts a consumer in a provider. **Breaking Changes** * `ProcessingUnit` and `MemoryUnit` renamed to `SimProcessingUnit` and `SimMemoryUnit` respectively. * `TimerScheduler` accepts a `CoroutineContext` as opposed to a `CoroutineScope`.
Diffstat (limited to 'simulator/opendc-runner-web/src')
-rw-r--r--simulator/opendc-runner-web/src/main/kotlin/org/opendc/runner/web/TopologyParser.kt12
1 files changed, 6 insertions, 6 deletions
diff --git a/simulator/opendc-runner-web/src/main/kotlin/org/opendc/runner/web/TopologyParser.kt b/simulator/opendc-runner-web/src/main/kotlin/org/opendc/runner/web/TopologyParser.kt
index e7e99a3d..0ff40a28 100644
--- a/simulator/opendc-runner-web/src/main/kotlin/org/opendc/runner/web/TopologyParser.kt
+++ b/simulator/opendc-runner-web/src/main/kotlin/org/opendc/runner/web/TopologyParser.kt
@@ -34,9 +34,9 @@ import org.opendc.compute.simulator.power.models.LinearPowerModel
import org.opendc.format.environment.EnvironmentReader
import org.opendc.format.environment.MachineDef
import org.opendc.simulator.compute.SimMachineModel
-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.model.SimMemoryUnit
+import org.opendc.simulator.compute.model.SimProcessingNode
+import org.opendc.simulator.compute.model.SimProcessingUnit
import java.util.*
/**
@@ -56,13 +56,13 @@ public class TopologyParser(private val collection: MongoCollection<Document>, p
val cores = cpu.getInteger("numberOfCores")
val speed = cpu.get("clockRateMhz", Number::class.java).toDouble()
// TODO Remove hardcoding of vendor
- val node = ProcessingNode("Intel", "amd64", cpu.getString("name"), cores)
+ val node = SimProcessingNode("Intel", "amd64", cpu.getString("name"), cores)
List(cores) { coreId ->
- ProcessingUnit(node, coreId, speed)
+ SimProcessingUnit(node, coreId, speed)
}
}
val memoryUnits = machine.getList("memories", Document::class.java).map { memory ->
- MemoryUnit(
+ SimMemoryUnit(
"Samsung",
memory.getString("name"),
memory.get("speedMbPerS", Number::class.java).toDouble(),