diff options
| author | Georgios Andreadis <g.andreadis@student.tudelft.nl> | 2020-04-12 15:44:53 +0200 |
|---|---|---|
| committer | Georgios Andreadis <g.andreadis@student.tudelft.nl> | 2020-04-12 15:44:53 +0200 |
| commit | 310daf42af741dee2f11d98eb929d2b6c0db141c (patch) | |
| tree | a0570137b64651bfecd0d3a1d0e0383c2c327cea /opendc/opendc-format/src | |
| parent | 5f141c8b6aa6cfe96333f0cc02015e490b90fca6 (diff) | |
| parent | 4a5ef5a41c8e008d5c09261de550d3f55eaa3348 (diff) | |
Merge branch 'bug/virt-driver-behavior' into '2.x'
Address multiple (performance) issues
See merge request opendc/opendc-simulator!58
Diffstat (limited to 'opendc/opendc-format/src')
| -rw-r--r-- | opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/sc20/Sc20TraceReader.kt | 15 |
1 files changed, 8 insertions, 7 deletions
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 776cbc4e..950d2630 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 @@ -36,6 +36,7 @@ import java.io.BufferedReader import java.io.File import java.io.FileReader import java.util.UUID +import kotlin.math.max /** * A [TraceReader] for the internal VM workload trace format. @@ -82,7 +83,7 @@ class Sc20TraceReader( println(vmFile) val flopsHistory = mutableListOf<FlopsHistoryFragment>() var vmId = "" - var cores = -1 + var maxCores = -1 var requiredMemory = -1L BufferedReader(FileReader(vmFile)).use { reader -> @@ -96,11 +97,12 @@ class Sc20TraceReader( vmId = vmFile.name val timestamp = (values[timestampCol].trim().toLong() - 5 * 60) * 1000L - cores = values[coreCol].trim().toInt() + val cores = values[coreCol].trim().toInt() val cpuUsage = values[cpuUsageCol].trim().toDouble() // MHz - requiredMemory = values[provisionedMemoryCol].trim().toLong() + requiredMemory = max(requiredMemory, values[provisionedMemoryCol].trim().toLong()) + maxCores = max(maxCores, cores) - val flops: Long = (cpuUsage * 5 * 60 * cores).toLong() + val flops: Long = (cpuUsage * 5 * 60).toLong() if (flopsHistory.isEmpty()) { flopsHistory.add(FlopsHistoryFragment(timestamp, flops, traceInterval, cpuUsage, cores)) @@ -115,8 +117,7 @@ class Sc20TraceReader( oldFragment.flops + flops, oldFragment.duration + traceInterval, cpuUsage, - cores - ) + cores) ) } } @@ -136,7 +137,7 @@ class Sc20TraceReader( vmId, mapOf(IMAGE_PERF_INTERFERENCE_MODEL to relevantPerformanceInterferenceModelItems), flopsHistory, - cores, + maxCores, requiredMemory ) ) |
