summaryrefslogtreecommitdiff
path: root/opendc-simulator/opendc-simulator-compute/src
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2022-10-06 15:34:19 +0200
committerGitHub <noreply@github.com>2022-10-06 15:34:19 +0200
commit7ba3b953300c46b4e3afcde17cd3dd14b1af8406 (patch)
tree950ba678869ec868c26ab3b95b57e4cabadb23c7 /opendc-simulator/opendc-simulator-compute/src
parentc2047d09b27b0c05f5c203509dde524e17d3b729 (diff)
parent47357afd16f928260db34d4dd3e686fb9ee7c5ff (diff)
merge: Update build and runtime dependencies (#107)
This pull request updates the build and runtime dependencies used by OpenDC to their latest version compatible with the project. ## Implementation Notes :hammer_and_pick: * Update simulator dependency versions * Remove unused distribution conventions * Update next version to 3.0 * Eliminate use of wildcard imports * Switch to Spotless for formatting
Diffstat (limited to 'opendc-simulator/opendc-simulator-compute/src')
-rw-r--r--opendc-simulator/opendc-simulator-compute/src/jmh/kotlin/org/opendc/simulator/compute/SimMachineBenchmarks.kt12
-rw-r--r--opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/SimAbstractMachine.kt8
-rw-r--r--opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/SimBareMetalMachine.kt5
-rw-r--r--opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/device/SimPsu.kt4
-rw-r--r--opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/SimHypervisor.kt10
-rw-r--r--opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/interference/VmInterferenceMember.kt2
-rw-r--r--opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/interference/VmInterferenceModel.kt8
-rw-r--r--opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/AsymptoticPowerModel.kt7
-rw-r--r--opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/InterpolationPowerModel.kt5
-rw-r--r--opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/MsePowerModel.kt2
-rw-r--r--opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/PStatePowerDriver.kt2
-rw-r--r--opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/ZeroIdlePowerDecorator.kt5
-rw-r--r--opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/workload/SimTrace.kt2
-rw-r--r--opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/SimMachineTest.kt17
-rw-r--r--opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/device/SimPsuTest.kt2
-rw-r--r--opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/kernel/SimFairShareHypervisorTest.kt12
-rw-r--r--opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/kernel/SimSpaceSharedHypervisorTest.kt16
-rw-r--r--opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/power/PStatePowerDriverTest.kt8
-rw-r--r--opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/power/PowerModelTest.kt4
-rw-r--r--opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/workload/SimTraceWorkloadTest.kt5
20 files changed, 93 insertions, 43 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 b319a677..220b97cc 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
@@ -36,7 +36,13 @@ 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.runSimulation
-import org.openjdk.jmh.annotations.*
+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
@@ -73,7 +79,9 @@ class SimMachineBenchmarks {
return runSimulation {
val engine = FlowEngine(coroutineContext, clock)
val machine = SimBareMetalMachine(
- engine, machineModel, SimplePowerDriver(ConstantPowerModel(0.0))
+ engine,
+ machineModel,
+ SimplePowerDriver(ConstantPowerModel(0.0))
)
return@runSimulation machine.runWorkload(SimTraceWorkload(trace))
}
diff --git a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/SimAbstractMachine.kt b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/SimAbstractMachine.kt
index ef0cd323..71784567 100644
--- a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/SimAbstractMachine.kt
+++ b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/SimAbstractMachine.kt
@@ -30,7 +30,13 @@ import org.opendc.simulator.compute.model.MemoryUnit
import org.opendc.simulator.compute.model.NetworkAdapter
import org.opendc.simulator.compute.model.StorageDevice
import org.opendc.simulator.compute.workload.SimWorkload
-import org.opendc.simulator.flow.*
+import org.opendc.simulator.flow.FlowConsumer
+import org.opendc.simulator.flow.FlowConvergenceListener
+import org.opendc.simulator.flow.FlowEngine
+import org.opendc.simulator.flow.FlowForwarder
+import org.opendc.simulator.flow.FlowSink
+import org.opendc.simulator.flow.FlowSource
+import org.opendc.simulator.flow.batch
/**
* Abstract implementation of the [SimMachine] interface.
diff --git a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/SimBareMetalMachine.kt b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/SimBareMetalMachine.kt
index 0df897b6..4c824440 100644
--- a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/SimBareMetalMachine.kt
+++ b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/SimBareMetalMachine.kt
@@ -26,8 +26,9 @@ import org.opendc.simulator.compute.device.SimPsu
import org.opendc.simulator.compute.model.MachineModel
import org.opendc.simulator.compute.model.ProcessingUnit
import org.opendc.simulator.compute.power.PowerDriver
-import org.opendc.simulator.flow.*
+import org.opendc.simulator.flow.FlowConsumer
import org.opendc.simulator.flow.FlowEngine
+import org.opendc.simulator.flow.FlowSink
import kotlin.math.max
/**
@@ -45,7 +46,7 @@ public class SimBareMetalMachine(
engine: FlowEngine,
model: MachineModel,
powerDriver: PowerDriver,
- public val psu: SimPsu = SimPsu(500.0, mapOf(1.0 to 1.0)),
+ public val psu: SimPsu = SimPsu(500.0, mapOf(1.0 to 1.0))
) : SimAbstractMachine(engine, model) {
/**
* The current power usage of the machine (without PSU loss) in W.
diff --git a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/device/SimPsu.kt b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/device/SimPsu.kt
index caff4dc3..3d3703ae 100644
--- a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/device/SimPsu.kt
+++ b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/device/SimPsu.kt
@@ -26,7 +26,7 @@ import org.opendc.simulator.compute.power.PowerDriver
import org.opendc.simulator.flow.FlowConnection
import org.opendc.simulator.flow.FlowSource
import org.opendc.simulator.power.SimPowerInlet
-import java.util.*
+import java.util.TreeMap
/**
* A power supply of a [SimBareMetalMachine].
@@ -36,7 +36,7 @@ import java.util.*
*/
public class SimPsu(
private val ratedOutputPower: Double,
- energyEfficiency: Map<Double, Double>,
+ energyEfficiency: Map<Double, Double>
) : SimPowerInlet() {
/**
* The power draw of the machine at this instant.
diff --git a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/SimHypervisor.kt b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/SimHypervisor.kt
index 7594bf4d..e1486d71 100644
--- a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/SimHypervisor.kt
+++ b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/SimHypervisor.kt
@@ -22,7 +22,10 @@
package org.opendc.simulator.compute.kernel
-import org.opendc.simulator.compute.*
+import org.opendc.simulator.compute.SimAbstractMachine
+import org.opendc.simulator.compute.SimMachine
+import org.opendc.simulator.compute.SimMachineContext
+import org.opendc.simulator.compute.SimProcessingUnit
import org.opendc.simulator.compute.kernel.cpufreq.ScalingGovernor
import org.opendc.simulator.compute.kernel.cpufreq.ScalingPolicy
import org.opendc.simulator.compute.kernel.interference.VmInterferenceDomain
@@ -31,7 +34,9 @@ import org.opendc.simulator.compute.kernel.interference.VmInterferenceProfile
import org.opendc.simulator.compute.model.MachineModel
import org.opendc.simulator.compute.model.ProcessingUnit
import org.opendc.simulator.compute.workload.SimWorkload
-import org.opendc.simulator.flow.*
+import org.opendc.simulator.flow.FlowConsumer
+import org.opendc.simulator.flow.FlowConvergenceListener
+import org.opendc.simulator.flow.FlowEngine
import org.opendc.simulator.flow.mux.FlowMultiplexer
import org.opendc.simulator.flow.mux.FlowMultiplexerFactory
import java.util.SplittableRandom
@@ -206,6 +211,7 @@ public class SimHypervisor(
*/
override val counters: SimHypervisorCounters
get() = _counters
+
@JvmField val _counters = VmCountersImpl(cpus, null)
/**
diff --git a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/interference/VmInterferenceMember.kt b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/interference/VmInterferenceMember.kt
index 762bb568..4b56a058 100644
--- a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/interference/VmInterferenceMember.kt
+++ b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/interference/VmInterferenceMember.kt
@@ -22,7 +22,7 @@
package org.opendc.simulator.compute.kernel.interference
-import java.util.*
+import java.util.SplittableRandom
/**
* A participant of an interference domain.
diff --git a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/interference/VmInterferenceModel.kt b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/interference/VmInterferenceModel.kt
index 018c6e3d..238bffc0 100644
--- a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/interference/VmInterferenceModel.kt
+++ b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/interference/VmInterferenceModel.kt
@@ -22,7 +22,8 @@
package org.opendc.simulator.compute.kernel.interference
-import java.util.*
+import java.util.TreeMap
+import java.util.TreeSet
/**
* An interference model that models the resource interference between virtual machines on a host.
@@ -128,10 +129,11 @@ public class VmInterferenceModel private constructor(
}
cmp = scores[l].compareTo(scores[r]) // Higher penalty first (this means lower performance score first)
- if (cmp != 0)
+ if (cmp != 0) {
cmp
- else
+ } else {
l.compareTo(r)
+ }
}
)
diff --git a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/AsymptoticPowerModel.kt b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/AsymptoticPowerModel.kt
index 62b85e12..46c397fe 100644
--- a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/AsymptoticPowerModel.kt
+++ b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/AsymptoticPowerModel.kt
@@ -39,15 +39,16 @@ public class AsymptoticPowerModel(
private val maxPower: Double,
private val idlePower: Double,
private val asymUtil: Double,
- private val isDvfsEnabled: Boolean,
+ private val isDvfsEnabled: Boolean
) : PowerModel {
private val factor: Double = (maxPower - idlePower) / 100
public override fun computePower(utilization: Double): Double =
- if (isDvfsEnabled)
+ if (isDvfsEnabled) {
idlePower + (factor * 100) / 2 * (1 + utilization.pow(3) - E.pow(-utilization.pow(3) / asymUtil))
- else
+ } else {
idlePower + (factor * 100) / 2 * (1 + utilization - E.pow(-utilization / asymUtil))
+ }
override fun toString(): String = "AsymptoticPowerModel[max=$maxPower,idle=$idlePower,asymptotic=$asymUtil]"
}
diff --git a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/InterpolationPowerModel.kt b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/InterpolationPowerModel.kt
index 2694700c..b17b87a9 100644
--- a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/InterpolationPowerModel.kt
+++ b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/InterpolationPowerModel.kt
@@ -44,10 +44,11 @@ public class InterpolationPowerModel(private val powerValues: List<Double>) : Po
val powerCil: Double = getAveragePowerValue(utilizationCil)
val delta = (powerCil - powerFlr) / 10
- return if (utilization % 0.1 == 0.0)
+ return if (utilization % 0.1 == 0.0) {
getAveragePowerValue((clampedUtilization * 10).toInt())
- else
+ } else {
powerFlr + delta * (clampedUtilization - utilizationFlr.toDouble() / 10) * 100
+ }
}
override fun toString(): String = "InterpolationPowerModel[entries=${powerValues.size}]"
diff --git a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/MsePowerModel.kt b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/MsePowerModel.kt
index 612ce2fc..e9e72da8 100644
--- a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/MsePowerModel.kt
+++ b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/MsePowerModel.kt
@@ -37,7 +37,7 @@ import kotlin.math.pow
public class MsePowerModel(
private val maxPower: Double,
private val idlePower: Double,
- private val calibrationParam: Double,
+ private val calibrationParam: Double
) : PowerModel {
private val factor: Double = (maxPower - idlePower) / 100
diff --git a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/PStatePowerDriver.kt b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/PStatePowerDriver.kt
index f71446f8..ce7225d2 100644
--- a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/PStatePowerDriver.kt
+++ b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/PStatePowerDriver.kt
@@ -24,7 +24,7 @@ package org.opendc.simulator.compute.power
import org.opendc.simulator.compute.SimMachine
import org.opendc.simulator.compute.SimProcessingUnit
-import java.util.*
+import java.util.TreeMap
import kotlin.math.max
import kotlin.math.min
diff --git a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/ZeroIdlePowerDecorator.kt b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/ZeroIdlePowerDecorator.kt
index 886227e1..05ab4631 100644
--- a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/ZeroIdlePowerDecorator.kt
+++ b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/ZeroIdlePowerDecorator.kt
@@ -29,10 +29,11 @@ package org.opendc.simulator.compute.power
*/
public class ZeroIdlePowerDecorator(private val delegate: PowerModel) : PowerModel {
override fun computePower(utilization: Double): Double {
- return if (utilization == 0.0)
+ return if (utilization == 0.0) {
0.0
- else
+ } else {
delegate.computePower(utilization)
+ }
}
override fun toString(): String = "ZeroIdlePowerDecorator[delegate=$delegate]"
diff --git a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/workload/SimTrace.kt b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/workload/SimTrace.kt
index e66227b5..db6a4629 100644
--- a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/workload/SimTrace.kt
+++ b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/workload/SimTrace.kt
@@ -39,7 +39,7 @@ public class SimTrace(
private val usageCol: DoubleArray,
private val deadlineCol: LongArray,
private val coresCol: IntArray,
- private val size: Int,
+ private val size: Int
) {
init {
require(size >= 0) { "Invalid trace size" }
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 b7af6803..1eddf82c 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
@@ -22,11 +22,22 @@
package org.opendc.simulator.compute
-import kotlinx.coroutines.*
-import org.junit.jupiter.api.*
+import kotlinx.coroutines.CancellationException
+import kotlinx.coroutines.cancel
+import kotlinx.coroutines.coroutineScope
+import kotlinx.coroutines.launch
+import org.junit.jupiter.api.Assertions.assertAll
import org.junit.jupiter.api.Assertions.assertEquals
+import org.junit.jupiter.api.BeforeEach
+import org.junit.jupiter.api.Test
+import org.junit.jupiter.api.assertThrows
import org.opendc.simulator.compute.device.SimNetworkAdapter
-import org.opendc.simulator.compute.model.*
+import org.opendc.simulator.compute.model.MachineModel
+import org.opendc.simulator.compute.model.MemoryUnit
+import org.opendc.simulator.compute.model.NetworkAdapter
+import org.opendc.simulator.compute.model.ProcessingNode
+import org.opendc.simulator.compute.model.ProcessingUnit
+import org.opendc.simulator.compute.model.StorageDevice
import org.opendc.simulator.compute.power.ConstantPowerModel
import org.opendc.simulator.compute.power.LinearPowerModel
import org.opendc.simulator.compute.power.SimplePowerDriver
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 5481cad2..0a6cb29f 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
@@ -75,7 +75,7 @@ internal class SimPsuTest {
val energyEfficiency = sortedMapOf(
0.3 to 0.9,
0.7 to 0.92,
- 1.0 to 0.94,
+ 1.0 to 0.94
)
val engine = FlowEngine(coroutineContext, clock)
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 aae8d139..6b498119 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
@@ -22,7 +22,9 @@
package org.opendc.simulator.compute.kernel
-import kotlinx.coroutines.*
+import kotlinx.coroutines.coroutineScope
+import kotlinx.coroutines.launch
+import kotlinx.coroutines.yield
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
@@ -44,7 +46,7 @@ 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.runSimulation
-import java.util.*
+import java.util.SplittableRandom
/**
* Test suite for the [SimHypervisor] class.
@@ -74,7 +76,7 @@ internal class SimFairShareHypervisorTest {
SimTraceFragment(duration * 1000, duration * 1000, 3500.0, 1),
SimTraceFragment(duration * 2000, duration * 1000, 0.0, 1),
SimTraceFragment(duration * 3000, duration * 1000, 183.0, 1)
- ),
+ )
)
val engine = FlowEngine(coroutineContext, clock)
@@ -114,7 +116,7 @@ internal class SimFairShareHypervisorTest {
SimTraceFragment(duration * 1000, duration * 1000, 3500.0, 1),
SimTraceFragment(duration * 2000, duration * 1000, 0.0, 1),
SimTraceFragment(duration * 3000, duration * 1000, 183.0, 1)
- ),
+ )
)
val workloadB =
SimTraceWorkload(
@@ -204,7 +206,7 @@ internal class SimFairShareHypervisorTest {
SimTraceFragment(duration * 1000, duration * 1000, 28.0, 1),
SimTraceFragment(duration * 2000, duration * 1000, 3500.0, 1),
SimTraceFragment(duration * 3000, duration * 1000, 183.0, 1)
- ),
+ )
)
val workloadB =
SimTraceWorkload(
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 664bb2da..57fe3766 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
@@ -24,7 +24,11 @@ package org.opendc.simulator.compute.kernel
import kotlinx.coroutines.launch
import kotlinx.coroutines.yield
-import org.junit.jupiter.api.Assertions.*
+import org.junit.jupiter.api.Assertions.assertAll
+import org.junit.jupiter.api.Assertions.assertDoesNotThrow
+import org.junit.jupiter.api.Assertions.assertEquals
+import org.junit.jupiter.api.Assertions.assertFalse
+import org.junit.jupiter.api.Assertions.assertTrue
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.assertThrows
@@ -36,11 +40,15 @@ import org.opendc.simulator.compute.model.ProcessingUnit
import org.opendc.simulator.compute.power.ConstantPowerModel
import org.opendc.simulator.compute.power.SimplePowerDriver
import org.opendc.simulator.compute.runWorkload
-import org.opendc.simulator.compute.workload.*
+import org.opendc.simulator.compute.workload.SimFlopsWorkload
+import org.opendc.simulator.compute.workload.SimRuntimeWorkload
+import org.opendc.simulator.compute.workload.SimTrace
+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.runSimulation
-import java.util.*
+import java.util.SplittableRandom
/**
* A test suite for a space-shared [SimHypervisor].
@@ -70,7 +78,7 @@ internal class SimSpaceSharedHypervisorTest {
SimTraceFragment(duration * 1000, duration * 1000, 3500.0, 1),
SimTraceFragment(duration * 2000, duration * 1000, 0.0, 1),
SimTraceFragment(duration * 3000, duration * 1000, 183.0, 1)
- ),
+ )
)
val engine = FlowEngine(coroutineContext, clock)
diff --git a/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/power/PStatePowerDriverTest.kt b/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/power/PStatePowerDriverTest.kt
index f557c8d3..3c0a55a6 100644
--- a/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/power/PStatePowerDriverTest.kt
+++ b/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/power/PStatePowerDriverTest.kt
@@ -41,7 +41,7 @@ internal class PStatePowerDriverTest {
sortedMapOf(
2800.0 to ConstantPowerModel(200.0),
3300.0 to ConstantPowerModel(300.0),
- 3600.0 to ConstantPowerModel(350.0),
+ 3600.0 to ConstantPowerModel(350.0)
)
)
@@ -61,7 +61,7 @@ internal class PStatePowerDriverTest {
sortedMapOf(
2800.0 to ConstantPowerModel(200.0),
3300.0 to ConstantPowerModel(300.0),
- 3600.0 to ConstantPowerModel(350.0),
+ 3600.0 to ConstantPowerModel(350.0)
)
)
@@ -86,7 +86,7 @@ internal class PStatePowerDriverTest {
sortedMapOf(
2800.0 to ConstantPowerModel(200.0),
3300.0 to ConstantPowerModel(300.0),
- 3600.0 to ConstantPowerModel(350.0),
+ 3600.0 to ConstantPowerModel(350.0)
)
)
@@ -106,7 +106,7 @@ internal class PStatePowerDriverTest {
sortedMapOf(
2800.0 to LinearPowerModel(200.0, 100.0),
3300.0 to LinearPowerModel(250.0, 150.0),
- 4000.0 to LinearPowerModel(300.0, 200.0),
+ 4000.0 to LinearPowerModel(300.0, 200.0)
)
)
diff --git a/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/power/PowerModelTest.kt b/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/power/PowerModelTest.kt
index 7852534a..67532d5b 100644
--- a/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/power/PowerModelTest.kt
+++ b/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/power/PowerModelTest.kt
@@ -72,7 +72,7 @@ internal class PowerModelTest {
{ assertEquals(189.0, powerModel.computePower(0.8)) },
{ assertEquals(189.0 + 0.7 * 10 * (205 - 189) / 10, powerModel.computePower(0.87)) },
{ assertEquals(205.0, powerModel.computePower(0.9)) },
- { assertEquals(222.0, powerModel.computePower(1.0)) },
+ { assertEquals(222.0, powerModel.computePower(1.0)) }
)
}
@@ -87,7 +87,7 @@ internal class PowerModelTest {
Arguments.of(SqrtPowerModel(350.0, 200.0), 342.302),
Arguments.of(MsePowerModel(350.0, 200.0, 1.4), 340.571),
Arguments.of(AsymptoticPowerModel(350.0, 200.0, 0.3, false), 338.765),
- Arguments.of(AsymptoticPowerModel(350.0, 200.0, 0.3, true), 323.072),
+ Arguments.of(AsymptoticPowerModel(350.0, 200.0, 0.3, true), 323.072)
)
}
}
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 70aea3f4..83e1f81c 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
@@ -27,7 +27,10 @@ import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.opendc.simulator.compute.SimBareMetalMachine
-import org.opendc.simulator.compute.model.*
+import org.opendc.simulator.compute.model.MachineModel
+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.power.SimplePowerDriver
import org.opendc.simulator.compute.runWorkload