summaryrefslogtreecommitdiff
path: root/opendc-simulator/opendc-simulator-compute/src/jmh
diff options
context:
space:
mode:
authorDante Niewenhuis <d.niewenhuis@hotmail.com>2024-12-06 15:44:09 +0100
committerGitHub <noreply@github.com>2024-12-06 15:44:09 +0100
commit8bbc3de611f9a679b5fb542241d32f887b4fe921 (patch)
treefd19092f7921359c0cc619693a29b15b8cda2db3 /opendc-simulator/opendc-simulator-compute/src/jmh
parent0ce9557b2960979e7e25be7aae05c389d51da17e (diff)
Renamed Multiplexer to FlowDistributor (#282)
* Restructured opendc-simulator-flow. Renamed Multiplexer to FlowDistributor. * spotless applied * Added FlowDistributor topologies back
Diffstat (limited to 'opendc-simulator/opendc-simulator-compute/src/jmh')
-rw-r--r--opendc-simulator/opendc-simulator-compute/src/jmh/kotlin/org/opendc/simulator/compute/SimMachineBenchmarks.kt162
1 files changed, 0 insertions, 162 deletions
diff --git a/opendc-simulator/opendc-simulator-compute/src/jmh/kotlin/org/opendc/simulator/compute/SimMachineBenchmarks.kt b/opendc-simulator/opendc-simulator-compute/src/jmh/kotlin/org/opendc/simulator/compute/SimMachineBenchmarks.kt
deleted file mode 100644
index 8d8f4ef8..00000000
--- a/opendc-simulator/opendc-simulator-compute/src/jmh/kotlin/org/opendc/simulator/compute/SimMachineBenchmarks.kt
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * 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.
- */
-
-package org.opendc.simulator.compute
-
-import kotlinx.coroutines.coroutineScope
-import kotlinx.coroutines.launch
-import org.opendc.simulator.compute.old.SimBareMetalMachine
-import org.opendc.simulator.compute.old.kernel.SimHypervisor
-import org.opendc.simulator.compute.old.model.CpuModel
-import org.opendc.simulator.compute.old.model.MachineModel
-import org.opendc.simulator.compute.old.model.MemoryUnit
-import org.opendc.simulator.compute.old.model.ProcessingNode
-import org.opendc.simulator.compute.old.workload.SimTrace
-import org.opendc.simulator.flow2.FlowEngine
-import org.opendc.simulator.flow2.mux.FlowMultiplexerFactory
-import org.opendc.simulator.kotlin.runSimulation
-import org.openjdk.jmh.annotations.Benchmark
-import org.openjdk.jmh.annotations.Fork
-import org.openjdk.jmh.annotations.Measurement
-import org.openjdk.jmh.annotations.Scope
-import org.openjdk.jmh.annotations.Setup
-import org.openjdk.jmh.annotations.State
-import org.openjdk.jmh.annotations.Warmup
-import java.util.SplittableRandom
-import java.util.concurrent.ThreadLocalRandom
-import java.util.concurrent.TimeUnit
-
-@State(Scope.Thread)
-@Fork(1)
-@Warmup(iterations = 2, time = 1, timeUnit = TimeUnit.SECONDS)
-@Measurement(iterations = 5, time = 3, timeUnit = TimeUnit.SECONDS)
-class SimMachineBenchmarks {
- private lateinit var machineModel: MachineModel
- private lateinit var trace: SimTrace
-
- @Setup
- fun setUp() {
- val cpuNode = ProcessingNode("Intel", "Xeon", "amd64", 2)
-
- machineModel =
- MachineModel(
- // cpus
- List(cpuNode.coreCount) {
- CpuModel(
- cpuNode,
- it,
- 1000.0,
- )
- },
- // memory
- List(4) { MemoryUnit("Crucial", "MTA18ASF4G72AZ-3G2B1", 3200.0, 32_000) },
- )
-
- val random = ThreadLocalRandom.current()
- val builder = SimTrace.builder()
- repeat(1000000) {
- val timestamp = it.toLong() * 1000
- val deadline = timestamp + 1000
- builder.add(deadline, random.nextDouble(0.0, 4500.0), 1)
- }
- trace = builder.build()
- }
-
- @Benchmark
- fun benchmarkBareMetal() {
- return runSimulation {
- val engine = FlowEngine.create(dispatcher)
- val graph = engine.newGraph()
- val machine = SimBareMetalMachine.create(graph, machineModel)
- return@runSimulation machine.runWorkload(trace.createWorkload(0))
- }
- }
-
- @Benchmark
- fun benchmarkSpaceSharedHypervisor() {
- return runSimulation {
- val engine = FlowEngine.create(dispatcher)
- val graph = engine.newGraph()
- val machine = SimBareMetalMachine.create(graph, machineModel)
- val hypervisor = SimHypervisor.create(FlowMultiplexerFactory.forwardingMultiplexer(), SplittableRandom(1))
-
- launch { machine.runWorkload(hypervisor) }
-
- val vm = hypervisor.newMachine(machineModel)
-
- try {
- return@runSimulation vm.runWorkload(trace.createWorkload(0))
- } finally {
- vm.cancel()
- machine.cancel()
- }
- }
- }
-
- @Benchmark
- fun benchmarkFairShareHypervisorSingle() {
- return runSimulation {
- val engine = FlowEngine.create(dispatcher)
- val graph = engine.newGraph()
- val machine = SimBareMetalMachine.create(graph, machineModel)
- val hypervisor = SimHypervisor.create(FlowMultiplexerFactory.maxMinMultiplexer(), SplittableRandom(1))
-
- launch { machine.runWorkload(hypervisor) }
-
- val vm = hypervisor.newMachine(machineModel)
-
- try {
- return@runSimulation vm.runWorkload(trace.createWorkload(0))
- } finally {
- vm.cancel()
- machine.cancel()
- }
- }
- }
-
- @Benchmark
- fun benchmarkFairShareHypervisorDouble() {
- return runSimulation {
- val engine = FlowEngine.create(dispatcher)
- val graph = engine.newGraph()
- val machine = SimBareMetalMachine.create(graph, machineModel)
- val hypervisor = SimHypervisor.create(FlowMultiplexerFactory.maxMinMultiplexer(), SplittableRandom(1))
-
- launch { machine.runWorkload(hypervisor) }
-
- coroutineScope {
- repeat(2) {
- val vm = hypervisor.newMachine(machineModel)
-
- launch {
- try {
- vm.runWorkload(trace.createWorkload(0))
- } finally {
- machine.cancel()
- }
- }
- }
- }
- machine.cancel()
- }
- }
-}