summaryrefslogtreecommitdiff
path: root/simulator/opendc-simulator/opendc-simulator-compute/src/jmh
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2021-04-07 13:07:28 +0200
committerGitHub <noreply@github.com>2021-04-07 13:07:28 +0200
commit519141f9af525a853b40eb821e70ca209bc104bf (patch)
tree3c8a4a3db41ac5be3a67f6427289a858805f98dc /simulator/opendc-simulator/opendc-simulator-compute/src/jmh
parent8f2855b9b9d81b15ff431775ba584c1e3f4add2c (diff)
parent3860d9e1c042eefacd5accb771cf47990090f649 (diff)
simulator: Add CPUFreq subsystem
This pull request adds a CPUFreq subsystem to the simulator module. This subsystem allows a simulated machine to perform frequency scaling, which in turn should reduce energy consumption.
Diffstat (limited to 'simulator/opendc-simulator/opendc-simulator-compute/src/jmh')
-rw-r--r--simulator/opendc-simulator/opendc-simulator-compute/src/jmh/kotlin/org/opendc/simulator/compute/SimMachineBenchmarks.kt23
1 files changed, 19 insertions, 4 deletions
diff --git a/simulator/opendc-simulator/opendc-simulator-compute/src/jmh/kotlin/org/opendc/simulator/compute/SimMachineBenchmarks.kt b/simulator/opendc-simulator/opendc-simulator-compute/src/jmh/kotlin/org/opendc/simulator/compute/SimMachineBenchmarks.kt
index eb22c855..c2a29f5b 100644
--- a/simulator/opendc-simulator/opendc-simulator-compute/src/jmh/kotlin/org/opendc/simulator/compute/SimMachineBenchmarks.kt
+++ b/simulator/opendc-simulator/opendc-simulator-compute/src/jmh/kotlin/org/opendc/simulator/compute/SimMachineBenchmarks.kt
@@ -27,9 +27,12 @@ import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.launch
import kotlinx.coroutines.test.TestCoroutineScope
import kotlinx.coroutines.test.runBlockingTest
+import org.opendc.simulator.compute.cpufreq.PerformanceScalingGovernor
+import org.opendc.simulator.compute.cpufreq.SimpleScalingDriver
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.power.ConstantPowerModel
import org.opendc.simulator.compute.workload.SimWorkload
import org.opendc.simulator.utils.DelayControllerClockAdapter
import org.opendc.utils.TimerScheduler
@@ -75,7 +78,10 @@ class SimMachineBenchmarks {
@Benchmark
fun benchmarkBareMetal(state: Workload) {
return scope.runBlockingTest {
- val machine = SimBareMetalMachine(scope.coroutineContext, clock, machineModel)
+ val machine = SimBareMetalMachine(
+ coroutineContext, clock, machineModel, PerformanceScalingGovernor(),
+ SimpleScalingDriver(ConstantPowerModel(0.0))
+ )
return@runBlockingTest machine.run(state.workloads[0])
}
}
@@ -83,7 +89,10 @@ class SimMachineBenchmarks {
@Benchmark
fun benchmarkSpaceSharedHypervisor(state: Workload) {
return scope.runBlockingTest {
- val machine = SimBareMetalMachine(coroutineContext, clock, machineModel)
+ val machine = SimBareMetalMachine(
+ coroutineContext, clock, machineModel, PerformanceScalingGovernor(),
+ SimpleScalingDriver(ConstantPowerModel(0.0))
+ )
val hypervisor = SimSpaceSharedHypervisor()
launch { machine.run(hypervisor) }
@@ -102,7 +111,10 @@ class SimMachineBenchmarks {
@Benchmark
fun benchmarkFairShareHypervisorSingle(state: Workload) {
return scope.runBlockingTest {
- val machine = SimBareMetalMachine(coroutineContext, clock, machineModel)
+ val machine = SimBareMetalMachine(
+ coroutineContext, clock, machineModel, PerformanceScalingGovernor(),
+ SimpleScalingDriver(ConstantPowerModel(0.0))
+ )
val hypervisor = SimFairShareHypervisor()
launch { machine.run(hypervisor) }
@@ -121,7 +133,10 @@ class SimMachineBenchmarks {
@Benchmark
fun benchmarkFairShareHypervisorDouble(state: Workload) {
return scope.runBlockingTest {
- val machine = SimBareMetalMachine(coroutineContext, clock, machineModel)
+ val machine = SimBareMetalMachine(
+ coroutineContext, clock, machineModel, PerformanceScalingGovernor(),
+ SimpleScalingDriver(ConstantPowerModel(0.0))
+ )
val hypervisor = SimFairShareHypervisor()
launch { machine.run(hypervisor) }