From 41813a71c0e91d40a356d2b00584196693358e48 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Mon, 13 Apr 2020 17:25:56 +0200 Subject: feat: Make workload identifiers deterministic --- .../format/environment/sc20/Sc20ClusterEnvironmentReader.kt | 3 ++- .../com/atlarge/opendc/format/trace/sc20/Sc20TraceReader.kt | 11 ++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'opendc/opendc-format') diff --git a/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/environment/sc20/Sc20ClusterEnvironmentReader.kt b/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/environment/sc20/Sc20ClusterEnvironmentReader.kt index 708e27bf..89a59e1c 100644 --- a/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/environment/sc20/Sc20ClusterEnvironmentReader.kt +++ b/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/environment/sc20/Sc20ClusterEnvironmentReader.kt @@ -59,6 +59,7 @@ class Sc20ClusterEnvironmentReader( var memoryPerHostCol = 0 var coresPerHostCol = 0 + var clusterIdx: Int = 0 var clusterId: String var speed: Double var numberOfHosts: Int @@ -99,7 +100,7 @@ class Sc20ClusterEnvironmentReader( nodes.add( SimpleBareMetalDriver( dom.newDomain("node-$clusterId-$it"), - UUID.randomUUID(), + UUID((clusterIdx++).toLong(), it.toLong()), "node-$clusterId-$it", mapOf(NODE_CLUSTER to clusterId), List(coresPerHost) { coreId -> diff --git a/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/sc20/Sc20TraceReader.kt b/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/sc20/Sc20TraceReader.kt index 950d2630..c40cb039 100644 --- a/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/sc20/Sc20TraceReader.kt +++ b/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/sc20/Sc20TraceReader.kt @@ -79,7 +79,7 @@ class Sc20TraceReader( } vms - .forEach { vmFile -> + .forEachIndexed { idx, vmFile -> println(vmFile) val flopsHistory = mutableListOf() var vmId = "" @@ -107,9 +107,8 @@ class Sc20TraceReader( if (flopsHistory.isEmpty()) { flopsHistory.add(FlopsHistoryFragment(timestamp, flops, traceInterval, cpuUsage, cores)) } else { - if (flopsHistory.last().flops != flops) { - flopsHistory.add(FlopsHistoryFragment(timestamp, flops, traceInterval, cpuUsage, cores)) - } else { + // Restrict merging to empty fragments for now + if (flopsHistory.last().flops == 0L && flops == 0L) { val oldFragment = flopsHistory.removeAt(flopsHistory.size - 1) flopsHistory.add( FlopsHistoryFragment( @@ -119,12 +118,14 @@ class Sc20TraceReader( cpuUsage, cores) ) + } else { + flopsHistory.add(FlopsHistoryFragment(timestamp, flops, traceInterval, cpuUsage, cores)) } } } } - val uuid = UUID.randomUUID() + val uuid = UUID(0, idx.toLong()) val relevantPerformanceInterferenceModelItems = PerformanceInterferenceModel( performanceInterferenceModel.items.filter { it.workloadNames.contains(vmId) }.toSet() -- cgit v1.2.3