diff options
| author | Georgios Andreadis <g.andreadis@student.tudelft.nl> | 2020-03-04 13:08:26 +0100 |
|---|---|---|
| committer | Georgios Andreadis <g.andreadis@student.tudelft.nl> | 2020-03-04 13:08:26 +0100 |
| commit | fa7455ac6aaa1e0c34a4218c32423d544373e795 (patch) | |
| tree | fd3a2b12bf5b3841ded39930ad2d3b0c1336448b /opendc/opendc-format | |
| parent | ac6e6f7c611fa7d10fff5467c4a61af932e4c171 (diff) | |
| parent | 5f5d54b6f1a96bc595f99f367bea54f1d852ec63 (diff) | |
Merge branch 'refactor/2.x-vm-improvements' into 'feat/2.x'
Report CPU usage per server instance
Closes #51
See merge request opendc/opendc-simulator!34
Diffstat (limited to 'opendc/opendc-format')
2 files changed, 20 insertions, 6 deletions
diff --git a/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/environment/sc18/Sc18EnvironmentReader.kt b/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/environment/sc18/Sc18EnvironmentReader.kt index 8898ddc7..942a8c72 100644 --- a/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/environment/sc18/Sc18EnvironmentReader.kt +++ b/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/environment/sc18/Sc18EnvironmentReader.kt @@ -27,6 +27,7 @@ package com.atlarge.opendc.format.environment.sc18 import com.atlarge.odcsim.Domain import com.atlarge.opendc.compute.core.ProcessingUnit import com.atlarge.opendc.compute.core.MemoryUnit +import com.atlarge.opendc.compute.core.ProcessingNode import com.atlarge.opendc.compute.metal.driver.SimpleBareMetalDriver import com.atlarge.opendc.compute.metal.service.ProvisioningService import com.atlarge.opendc.compute.metal.service.SimpleProvisioningService @@ -63,10 +64,16 @@ class Sc18EnvironmentReader(input: InputStream, mapper: ObjectMapper = jacksonOb when (roomObject) { is RoomObject.Rack -> { roomObject.machines.map { machine -> - val cores = machine.cpus.map { id -> + val cores = machine.cpus.flatMap { id -> when (id) { - 1 -> ProcessingUnit("Intel", "Core(TM) i7-6920HQ", "amd64", 4100.0, 4) - 2 -> ProcessingUnit("Intel", "Core(TM) I7-6920HQ", "amd64", 3500.0, 2) + 1 -> { + val node = ProcessingNode("Intel", "Core(TM) i7-6920HQ", "amd64", 4) + List(node.coreCount) { ProcessingUnit(node, it, 4100.0) } + } + 2 -> { + val node = ProcessingNode("Intel", "Core(TM) i7-6920HQ", "amd64", 2) + List(node.coreCount) { ProcessingUnit(node, it, 3500.0) } + } else -> throw IllegalArgumentException("The cpu id $id is not recognized") } } diff --git a/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/environment/sc20/Sc20EnvironmentReader.kt b/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/environment/sc20/Sc20EnvironmentReader.kt index fecba302..b33a5e93 100644 --- a/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/environment/sc20/Sc20EnvironmentReader.kt +++ b/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/environment/sc20/Sc20EnvironmentReader.kt @@ -26,6 +26,7 @@ package com.atlarge.opendc.format.environment.sc20 import com.atlarge.odcsim.Domain import com.atlarge.opendc.compute.core.MemoryUnit +import com.atlarge.opendc.compute.core.ProcessingNode import com.atlarge.opendc.compute.core.ProcessingUnit import com.atlarge.opendc.compute.metal.driver.SimpleBareMetalDriver import com.atlarge.opendc.compute.metal.service.ProvisioningService @@ -60,10 +61,16 @@ class Sc20EnvironmentReader(input: InputStream, mapper: ObjectMapper = jacksonOb when (roomObject) { is RoomObject.Rack -> { roomObject.machines.map { machine -> - val cores = machine.cpus.map { id -> + val cores = machine.cpus.flatMap { id -> when (id) { - 1 -> ProcessingUnit("Intel", "Core(TM) i7-6920HQ", "amd64", 4100.0, 4) - 2 -> ProcessingUnit("Intel", "Core(TM) I7-6920HQ", "amd64", 3500.0, 2) + 1 -> { + val node = ProcessingNode("Intel", "Core(TM) i7-6920HQ", "amd64", 4) + List(node.coreCount) { ProcessingUnit(node, it, 4100.0) } + } + 2 -> { + val node = ProcessingNode("Intel", "Core(TM) i7-6920HQ", "amd64", 2) + List(node.coreCount) { ProcessingUnit(node, it, 3500.0) } + } else -> throw IllegalArgumentException("The cpu id $id is not recognized") } } |
