summaryrefslogtreecommitdiff
path: root/opendc-simulator/opendc-simulator-compute
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2022-10-05 14:10:11 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2022-10-05 14:10:11 +0200
commitbe176910eb870209576326ffaad8bf21241fccbd (patch)
tree3903d8aed5e87850c92e1b2dce8379ea99bdfa6d /opendc-simulator/opendc-simulator-compute
parentc214a7fe0d46ecc23a71f9237b20281c0ca1c929 (diff)
refactor(sim/core): Rename runBlockingSimulation to runSimulation
This change renames the method `runBlockingSimulation` to `runSimulation` to put more emphasis on the simulation part of the method. The blocking part is not that important, but this behavior is still described in the method documentation.
Diffstat (limited to 'opendc-simulator/opendc-simulator-compute')
-rw-r--r--opendc-simulator/opendc-simulator-compute/src/jmh/kotlin/org/opendc/simulator/compute/SimMachineBenchmarks.kt16
-rw-r--r--opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/SimMachineTest.kt24
-rw-r--r--opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/device/SimPsuTest.kt6
-rw-r--r--opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/kernel/SimFairShareHypervisorTest.kt10
-rw-r--r--opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/kernel/SimSpaceSharedHypervisorTest.kt14
-rw-r--r--opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/workload/SimTraceWorkloadTest.kt10
6 files changed, 40 insertions, 40 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
index a2dc9a0f..b319a677 100644
--- 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
@@ -35,7 +35,7 @@ import org.opendc.simulator.compute.workload.SimTrace
import org.opendc.simulator.compute.workload.SimTraceWorkload
import org.opendc.simulator.flow.FlowEngine
import org.opendc.simulator.flow.mux.FlowMultiplexerFactory
-import org.opendc.simulator.kotlin.runBlockingSimulation
+import org.opendc.simulator.kotlin.runSimulation
import org.openjdk.jmh.annotations.*
import java.util.SplittableRandom
import java.util.concurrent.ThreadLocalRandom
@@ -70,18 +70,18 @@ class SimMachineBenchmarks {
@Benchmark
fun benchmarkBareMetal() {
- return runBlockingSimulation {
+ return runSimulation {
val engine = FlowEngine(coroutineContext, clock)
val machine = SimBareMetalMachine(
engine, machineModel, SimplePowerDriver(ConstantPowerModel(0.0))
)
- return@runBlockingSimulation machine.runWorkload(SimTraceWorkload(trace))
+ return@runSimulation machine.runWorkload(SimTraceWorkload(trace))
}
}
@Benchmark
fun benchmarkSpaceSharedHypervisor() {
- return runBlockingSimulation {
+ return runSimulation {
val engine = FlowEngine(coroutineContext, clock)
val machine = SimBareMetalMachine(engine, machineModel, SimplePowerDriver(ConstantPowerModel(0.0)))
val hypervisor = SimHypervisor(engine, FlowMultiplexerFactory.forwardingMultiplexer(), SplittableRandom(1), null)
@@ -91,7 +91,7 @@ class SimMachineBenchmarks {
val vm = hypervisor.newMachine(machineModel)
try {
- return@runBlockingSimulation vm.runWorkload(SimTraceWorkload(trace))
+ return@runSimulation vm.runWorkload(SimTraceWorkload(trace))
} finally {
vm.cancel()
machine.cancel()
@@ -101,7 +101,7 @@ class SimMachineBenchmarks {
@Benchmark
fun benchmarkFairShareHypervisorSingle() {
- return runBlockingSimulation {
+ return runSimulation {
val engine = FlowEngine(coroutineContext, clock)
val machine = SimBareMetalMachine(engine, machineModel, SimplePowerDriver(ConstantPowerModel(0.0)))
val hypervisor = SimHypervisor(engine, FlowMultiplexerFactory.maxMinMultiplexer(), SplittableRandom(1), null)
@@ -111,7 +111,7 @@ class SimMachineBenchmarks {
val vm = hypervisor.newMachine(machineModel)
try {
- return@runBlockingSimulation vm.runWorkload(SimTraceWorkload(trace))
+ return@runSimulation vm.runWorkload(SimTraceWorkload(trace))
} finally {
vm.cancel()
machine.cancel()
@@ -121,7 +121,7 @@ class SimMachineBenchmarks {
@Benchmark
fun benchmarkFairShareHypervisorDouble() {
- return runBlockingSimulation {
+ return runSimulation {
val engine = FlowEngine(coroutineContext, clock)
val machine = SimBareMetalMachine(engine, machineModel, SimplePowerDriver(ConstantPowerModel(0.0)))
val hypervisor = SimHypervisor(engine, FlowMultiplexerFactory.maxMinMultiplexer(), SplittableRandom(1), null)
diff --git a/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/SimMachineTest.kt b/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/SimMachineTest.kt
index b0175917..b7af6803 100644
--- a/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/SimMachineTest.kt
+++ b/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/SimMachineTest.kt
@@ -35,7 +35,7 @@ import org.opendc.simulator.compute.workload.SimWorkload
import org.opendc.simulator.compute.workload.SimWorkloadLifecycle
import org.opendc.simulator.flow.FlowEngine
import org.opendc.simulator.flow.source.FixedFlowSource
-import org.opendc.simulator.kotlin.runBlockingSimulation
+import org.opendc.simulator.kotlin.runSimulation
import org.opendc.simulator.network.SimNetworkSink
import org.opendc.simulator.power.SimPowerSource
@@ -58,7 +58,7 @@ class SimMachineTest {
}
@Test
- fun testFlopsWorkload() = runBlockingSimulation {
+ fun testFlopsWorkload() = runSimulation {
val machine = SimBareMetalMachine(
FlowEngine(coroutineContext, clock),
machineModel,
@@ -72,7 +72,7 @@ class SimMachineTest {
}
@Test
- fun testDualSocketMachine() = runBlockingSimulation {
+ fun testDualSocketMachine() = runSimulation {
val cpuNode = machineModel.cpus[0].node
val machineModel = MachineModel(
cpus = List(cpuNode.coreCount * 2) { ProcessingUnit(cpuNode, it % 2, 1000.0) },
@@ -91,7 +91,7 @@ class SimMachineTest {
}
@Test
- fun testPower() = runBlockingSimulation {
+ fun testPower() = runSimulation {
val engine = FlowEngine(coroutineContext, clock)
val machine = SimBareMetalMachine(
engine,
@@ -111,7 +111,7 @@ class SimMachineTest {
}
@Test
- fun testCapacityClamp() = runBlockingSimulation {
+ fun testCapacityClamp() = runSimulation {
val machine = SimBareMetalMachine(
FlowEngine(coroutineContext, clock),
machineModel,
@@ -135,7 +135,7 @@ class SimMachineTest {
}
@Test
- fun testMemory() = runBlockingSimulation {
+ fun testMemory() = runSimulation {
val machine = SimBareMetalMachine(
FlowEngine(coroutineContext, clock),
machineModel,
@@ -153,7 +153,7 @@ class SimMachineTest {
}
@Test
- fun testMemoryUsage() = runBlockingSimulation {
+ fun testMemoryUsage() = runSimulation {
val machine = SimBareMetalMachine(
FlowEngine(coroutineContext, clock),
machineModel,
@@ -173,7 +173,7 @@ class SimMachineTest {
}
@Test
- fun testNetUsage() = runBlockingSimulation {
+ fun testNetUsage() = runSimulation {
val engine = FlowEngine(coroutineContext, clock)
val machine = SimBareMetalMachine(
engine,
@@ -198,7 +198,7 @@ class SimMachineTest {
}
@Test
- fun testDiskReadUsage() = runBlockingSimulation {
+ fun testDiskReadUsage() = runSimulation {
val engine = FlowEngine(coroutineContext, clock)
val machine = SimBareMetalMachine(
engine,
@@ -220,7 +220,7 @@ class SimMachineTest {
}
@Test
- fun testDiskWriteUsage() = runBlockingSimulation {
+ fun testDiskWriteUsage() = runSimulation {
val engine = FlowEngine(coroutineContext, clock)
val machine = SimBareMetalMachine(
engine,
@@ -242,7 +242,7 @@ class SimMachineTest {
}
@Test
- fun testCancellation() = runBlockingSimulation {
+ fun testCancellation() = runSimulation {
val machine = SimBareMetalMachine(
FlowEngine(coroutineContext, clock),
machineModel,
@@ -262,7 +262,7 @@ class SimMachineTest {
}
@Test
- fun testConcurrentRuns() = runBlockingSimulation {
+ fun testConcurrentRuns() = runSimulation {
val machine = SimBareMetalMachine(
FlowEngine(coroutineContext, clock),
machineModel,
diff --git a/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/device/SimPsuTest.kt b/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/device/SimPsuTest.kt
index 82ceeecd..5481cad2 100644
--- a/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/device/SimPsuTest.kt
+++ b/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/device/SimPsuTest.kt
@@ -29,7 +29,7 @@ import org.junit.jupiter.api.Test
import org.junit.jupiter.api.assertThrows
import org.opendc.simulator.compute.power.PowerDriver
import org.opendc.simulator.flow.FlowEngine
-import org.opendc.simulator.kotlin.runBlockingSimulation
+import org.opendc.simulator.kotlin.runSimulation
import org.opendc.simulator.power.SimPowerSource
/**
@@ -51,7 +51,7 @@ internal class SimPsuTest {
}
@Test
- fun testPsuIdle() = runBlockingSimulation {
+ fun testPsuIdle() = runSimulation {
val ratedOutputPower = 240.0
val energyEfficiency = mapOf(0.0 to 1.0)
@@ -69,7 +69,7 @@ internal class SimPsuTest {
}
@Test
- fun testPsuPowerLoss() = runBlockingSimulation {
+ fun testPsuPowerLoss() = runSimulation {
val ratedOutputPower = 240.0
// Efficiency of 80 Plus Titanium PSU
val energyEfficiency = sortedMapOf(
diff --git a/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/kernel/SimFairShareHypervisorTest.kt b/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/kernel/SimFairShareHypervisorTest.kt
index 35e14864..aae8d139 100644
--- a/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/kernel/SimFairShareHypervisorTest.kt
+++ b/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/kernel/SimFairShareHypervisorTest.kt
@@ -43,7 +43,7 @@ import org.opendc.simulator.compute.workload.SimTraceFragment
import org.opendc.simulator.compute.workload.SimTraceWorkload
import org.opendc.simulator.flow.FlowEngine
import org.opendc.simulator.flow.mux.FlowMultiplexerFactory
-import org.opendc.simulator.kotlin.runBlockingSimulation
+import org.opendc.simulator.kotlin.runSimulation
import java.util.*
/**
@@ -65,7 +65,7 @@ internal class SimFairShareHypervisorTest {
* Test overcommitting of resources via the hypervisor with a single VM.
*/
@Test
- fun testOvercommittedSingle() = runBlockingSimulation {
+ fun testOvercommittedSingle() = runSimulation {
val duration = 5 * 60L
val workloadA =
SimTraceWorkload(
@@ -105,7 +105,7 @@ internal class SimFairShareHypervisorTest {
* Test overcommitting of resources via the hypervisor with two VMs.
*/
@Test
- fun testOvercommittedDual() = runBlockingSimulation {
+ fun testOvercommittedDual() = runSimulation {
val duration = 5 * 60L
val workloadA =
SimTraceWorkload(
@@ -158,7 +158,7 @@ internal class SimFairShareHypervisorTest {
}
@Test
- fun testMultipleCPUs() = runBlockingSimulation {
+ fun testMultipleCPUs() = runSimulation {
val cpuNode = ProcessingNode("Intel", "Xeon", "amd64", 2)
val model = MachineModel(
cpus = List(cpuNode.coreCount) { ProcessingUnit(cpuNode, it, 3200.0) },
@@ -179,7 +179,7 @@ internal class SimFairShareHypervisorTest {
}
@Test
- fun testInterference() = runBlockingSimulation {
+ fun testInterference() = runSimulation {
val cpuNode = ProcessingNode("Intel", "Xeon", "amd64", 2)
val model = MachineModel(
cpus = List(cpuNode.coreCount) { ProcessingUnit(cpuNode, it, 3200.0) },
diff --git a/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/kernel/SimSpaceSharedHypervisorTest.kt b/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/kernel/SimSpaceSharedHypervisorTest.kt
index 96eabf5c..664bb2da 100644
--- a/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/kernel/SimSpaceSharedHypervisorTest.kt
+++ b/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/kernel/SimSpaceSharedHypervisorTest.kt
@@ -39,7 +39,7 @@ import org.opendc.simulator.compute.runWorkload
import org.opendc.simulator.compute.workload.*
import org.opendc.simulator.flow.FlowEngine
import org.opendc.simulator.flow.mux.FlowMultiplexerFactory
-import org.opendc.simulator.kotlin.runBlockingSimulation
+import org.opendc.simulator.kotlin.runSimulation
import java.util.*
/**
@@ -61,7 +61,7 @@ internal class SimSpaceSharedHypervisorTest {
* Test a trace workload.
*/
@Test
- fun testTrace() = runBlockingSimulation {
+ fun testTrace() = runSimulation {
val duration = 5 * 60L
val workloadA =
SimTraceWorkload(
@@ -92,7 +92,7 @@ internal class SimSpaceSharedHypervisorTest {
* Test runtime workload on hypervisor.
*/
@Test
- fun testRuntimeWorkload() = runBlockingSimulation {
+ fun testRuntimeWorkload() = runSimulation {
val duration = 5 * 60L * 1000
val workload = SimRuntimeWorkload(duration)
val engine = FlowEngine(coroutineContext, clock)
@@ -114,7 +114,7 @@ internal class SimSpaceSharedHypervisorTest {
* Test FLOPs workload on hypervisor.
*/
@Test
- fun testFlopsWorkload() = runBlockingSimulation {
+ fun testFlopsWorkload() = runSimulation {
val duration = 5 * 60L * 1000
val workload = SimFlopsWorkload((duration * 3.2).toLong(), 1.0)
val engine = FlowEngine(coroutineContext, clock)
@@ -134,7 +134,7 @@ internal class SimSpaceSharedHypervisorTest {
* Test two workloads running sequentially.
*/
@Test
- fun testTwoWorkloads() = runBlockingSimulation {
+ fun testTwoWorkloads() = runSimulation {
val duration = 5 * 60L * 1000
val engine = FlowEngine(coroutineContext, clock)
val machine = SimBareMetalMachine(engine, machineModel, SimplePowerDriver(ConstantPowerModel(0.0)))
@@ -162,7 +162,7 @@ internal class SimSpaceSharedHypervisorTest {
* Test concurrent workloads on the machine.
*/
@Test
- fun testConcurrentWorkloadFails() = runBlockingSimulation {
+ fun testConcurrentWorkloadFails() = runSimulation {
val engine = FlowEngine(coroutineContext, clock)
val machine = SimBareMetalMachine(engine, machineModel, SimplePowerDriver(ConstantPowerModel(0.0)))
val hypervisor = SimHypervisor(engine, FlowMultiplexerFactory.forwardingMultiplexer(), SplittableRandom(1), null)
@@ -184,7 +184,7 @@ internal class SimSpaceSharedHypervisorTest {
* Test concurrent workloads on the machine.
*/
@Test
- fun testConcurrentWorkloadSucceeds() = runBlockingSimulation {
+ fun testConcurrentWorkloadSucceeds() = runSimulation {
val engine = FlowEngine(coroutineContext, clock)
val machine = SimBareMetalMachine(engine, machineModel, SimplePowerDriver(ConstantPowerModel(0.0)))
val hypervisor = SimHypervisor(engine, FlowMultiplexerFactory.forwardingMultiplexer(), SplittableRandom(1), null)
diff --git a/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/workload/SimTraceWorkloadTest.kt b/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/workload/SimTraceWorkloadTest.kt
index bf4e7622..70aea3f4 100644
--- a/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/workload/SimTraceWorkloadTest.kt
+++ b/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/workload/SimTraceWorkloadTest.kt
@@ -32,7 +32,7 @@ import org.opendc.simulator.compute.power.ConstantPowerModel
import org.opendc.simulator.compute.power.SimplePowerDriver
import org.opendc.simulator.compute.runWorkload
import org.opendc.simulator.flow.FlowEngine
-import org.opendc.simulator.kotlin.runBlockingSimulation
+import org.opendc.simulator.kotlin.runSimulation
/**
* Test suite for the [SimTraceWorkloadTest] class.
@@ -51,7 +51,7 @@ class SimTraceWorkloadTest {
}
@Test
- fun testSmoke() = runBlockingSimulation {
+ fun testSmoke() = runSimulation {
val machine = SimBareMetalMachine(
FlowEngine(coroutineContext, clock),
machineModel,
@@ -74,7 +74,7 @@ class SimTraceWorkloadTest {
}
@Test
- fun testOffset() = runBlockingSimulation {
+ fun testOffset() = runSimulation {
val machine = SimBareMetalMachine(
FlowEngine(coroutineContext, clock),
machineModel,
@@ -97,7 +97,7 @@ class SimTraceWorkloadTest {
}
@Test
- fun testSkipFragment() = runBlockingSimulation {
+ fun testSkipFragment() = runSimulation {
val machine = SimBareMetalMachine(
FlowEngine(coroutineContext, clock),
machineModel,
@@ -121,7 +121,7 @@ class SimTraceWorkloadTest {
}
@Test
- fun testZeroCores() = runBlockingSimulation {
+ fun testZeroCores() = runSimulation {
val machine = SimBareMetalMachine(
FlowEngine(coroutineContext, clock),
machineModel,