summaryrefslogtreecommitdiff
path: root/opendc-simulator/opendc-simulator-compute/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'opendc-simulator/opendc-simulator-compute/src/main')
-rw-r--r--opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/SimBareMetalMachine.kt2
-rw-r--r--opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/device/SimPsu.kt2
-rw-r--r--opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/SimHypervisor.kt1
-rw-r--r--opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/interference/VmInterferenceModel.kt5
-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/ZeroIdlePowerDecorator.kt5
-rw-r--r--opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/workload/SimTrace.kt2
9 files changed, 18 insertions, 13 deletions
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 ee56c8c8..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
@@ -46,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 243790b9..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
@@ -36,7 +36,7 @@ import java.util.TreeMap
*/
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 20d946a4..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
@@ -211,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/VmInterferenceModel.kt b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/interference/VmInterferenceModel.kt
index 36fad4c3..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
@@ -129,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/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" }