summaryrefslogtreecommitdiff
path: root/opendc-compute
diff options
context:
space:
mode:
Diffstat (limited to 'opendc-compute')
-rw-r--r--opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/TopologyFactories.kt14
-rw-r--r--opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/specs/JSONSpecs.kt5
2 files changed, 13 insertions, 6 deletions
diff --git a/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/TopologyFactories.kt b/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/TopologyFactories.kt
index 47ba8058..e6b36dba 100644
--- a/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/TopologyFactories.kt
+++ b/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/TopologyFactories.kt
@@ -54,7 +54,6 @@ public fun clusterTopology(
random: RandomGenerator = SplittableRandom(0),
): List<HostSpec> {
val topology = reader.read(file)
-
return topology.toHostSpecs(random)
}
@@ -66,7 +65,6 @@ public fun clusterTopology(
random: RandomGenerator = SplittableRandom(0),
): List<HostSpec> {
val topology = reader.read(input)
-
return topology.toHostSpecs(random)
}
@@ -74,7 +72,11 @@ public fun clusterTopology(
* Helper method to convert a [TopologyJSONSpec] into a list of [HostSpec]s.
*/
private fun TopologyJSONSpec.toHostSpecs(random: RandomGenerator): List<HostSpec> {
- return clusters.flatMap { cluster -> List(cluster.count) { cluster.toHostSpecs(random) }.flatten() }
+ return clusters.flatMap { cluster ->
+ List(cluster.count) {
+ cluster.toHostSpecs(random)
+ }.flatten()
+ }
}
/**
@@ -87,7 +89,10 @@ private fun ClusterJSONSpec.toHostSpecs(random: RandomGenerator): List<HostSpec>
hosts.flatMap { host ->
(
List(host.count) {
- host.toHostSpecs(clusterId, random)
+ host.toHostSpecs(
+ clusterId,
+ random,
+ )
}
)
}
@@ -116,6 +121,7 @@ private fun HostJSONSpec.toHostSpecs(
)
val powerModel = getPowerModel(powerModel.modelType, powerModel.power, powerModel.maxPower, powerModel.idlePower)
+
val hostSpec =
HostSpec(
UUID(random.nextLong(), (hostId).toLong()),
diff --git a/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/specs/JSONSpecs.kt b/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/specs/JSONSpecs.kt
index fbdb4f5f..5e0af541 100644
--- a/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/specs/JSONSpecs.kt
+++ b/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/specs/JSONSpecs.kt
@@ -55,8 +55,9 @@ public data class ClusterJSONSpec(
*
* @param name The name of the host.
* @param cpus List of the different CPUs available in this cluster
- * @param memCapacity The amount of RAM memory available in Byte
+ * @param memory The amount of RAM memory available in Byte
* @param powerModel The power model used to determine the power draw of a host
+ * @param count The power model used to determine the power draw of a host
*/
@Serializable
public data class HostJSONSpec(
@@ -108,6 +109,6 @@ public data class MemoryJSONSpec(
public data class PowerModelJSONSpec(
val modelType: String,
val power: Double = 400.0,
- val maxPower: Double,
val idlePower: Double,
+ val maxPower: Double,
)