diff options
| author | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2021-08-17 19:25:11 +0200 |
|---|---|---|
| committer | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2021-08-24 11:20:17 +0200 |
| commit | 31a1f298c71cd3203fdcd57bd39ba8813009dd5b (patch) | |
| tree | 02cc92ae680d05c766388c96f538faa14bc6fe83 /opendc-format/src/main/kotlin/org | |
| parent | f03129779a1ec60e8689ad9c7fd5ad488c66f54c (diff) | |
refactor(simulator): Execute traces based on timestamps
This change refactors the trace workload in the OpenDC simulator to
track execute a fragment based on the fragment's timestamp. This makes
sure that the trace is replayed identically to the original execution.
Diffstat (limited to 'opendc-format/src/main/kotlin/org')
| -rw-r--r-- | opendc-format/src/main/kotlin/org/opendc/format/trace/bitbrains/BitbrainsTraceReader.kt | 7 | ||||
| -rw-r--r-- | opendc-format/src/main/kotlin/org/opendc/format/trace/swf/SwfTraceReader.kt | 5 |
2 files changed, 9 insertions, 3 deletions
diff --git a/opendc-format/src/main/kotlin/org/opendc/format/trace/bitbrains/BitbrainsTraceReader.kt b/opendc-format/src/main/kotlin/org/opendc/format/trace/bitbrains/BitbrainsTraceReader.kt index aaf8a240..cd8021fe 100644 --- a/opendc-format/src/main/kotlin/org/opendc/format/trace/bitbrains/BitbrainsTraceReader.kt +++ b/opendc-format/src/main/kotlin/org/opendc/format/trace/bitbrains/BitbrainsTraceReader.kt @@ -85,17 +85,19 @@ public class BitbrainsTraceReader(traceDirectory: File) : TraceReader<SimWorkloa } vmId = vmFile.nameWithoutExtension.trim().toLong() - startTime = min(startTime, values[timestampCol].trim().toLong() - 5 * 60) + val timestamp = values[timestampCol].trim().toLong() - 5 * 60 + startTime = min(startTime, timestamp) cores = values[coreCol].trim().toInt() val cpuUsage = values[cpuUsageCol].trim().toDouble() // MHz requiredMemory = (values[provisionedMemoryCol].trim().toDouble() / 1000).toLong() if (flopsHistory.isEmpty()) { - flopsHistory.add(SimTraceWorkload.Fragment(traceInterval, cpuUsage, cores)) + flopsHistory.add(SimTraceWorkload.Fragment(timestamp, traceInterval, cpuUsage, cores)) } else { if (flopsHistory.last().usage != cpuUsage) { flopsHistory.add( SimTraceWorkload.Fragment( + timestamp, traceInterval, cpuUsage, cores @@ -105,6 +107,7 @@ public class BitbrainsTraceReader(traceDirectory: File) : TraceReader<SimWorkloa val oldFragment = flopsHistory.removeAt(flopsHistory.size - 1) flopsHistory.add( SimTraceWorkload.Fragment( + oldFragment.timestamp, oldFragment.duration + traceInterval, cpuUsage, cores diff --git a/opendc-format/src/main/kotlin/org/opendc/format/trace/swf/SwfTraceReader.kt b/opendc-format/src/main/kotlin/org/opendc/format/trace/swf/SwfTraceReader.kt index 50ab652e..bda392a9 100644 --- a/opendc-format/src/main/kotlin/org/opendc/format/trace/swf/SwfTraceReader.kt +++ b/opendc-format/src/main/kotlin/org/opendc/format/trace/swf/SwfTraceReader.kt @@ -108,7 +108,8 @@ public class SwfTraceReader( for (tick in submitTime until (submitTime + waitTime - sliceDuration) step sliceDuration) { flopsHistory.add( SimTraceWorkload.Fragment( - sliceDuration * 1000L, + tick, + sliceDuration * 1000, 0.0, cores ) @@ -128,6 +129,7 @@ public class SwfTraceReader( ) { flopsHistory.add( SimTraceWorkload.Fragment( + tick, sliceDuration * 1000L, 1.0, cores @@ -138,6 +140,7 @@ public class SwfTraceReader( if (runtimePartialSliceRemainder > 0) { flopsHistory.add( SimTraceWorkload.Fragment( + submitTime + slicedWaitTime + runTime, sliceDuration, runtimePartialSliceRemainder / sliceDuration.toDouble(), cores |
