summaryrefslogtreecommitdiff
path: root/opendc/opendc-format/src
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2020-02-28 12:43:18 +0100
committerFabian Mastenbroek <mail.fabianm@gmail.com>2020-02-28 12:43:18 +0100
commit6c295a937834cf0e5b061bade1dddf66e4997648 (patch)
tree149b03d55d90a2047a428427c509233e69ddd19f /opendc/opendc-format/src
parentedc5234be4440499b15450f66c9e699f8ed8cc71 (diff)
bug: Fix timing issues to to unit differences
Diffstat (limited to 'opendc/opendc-format/src')
-rw-r--r--opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/vm/VmTraceReader.kt11
1 files changed, 6 insertions, 5 deletions
diff --git a/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/vm/VmTraceReader.kt b/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/vm/VmTraceReader.kt
index c3db9d33..2e881a6c 100644
--- a/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/vm/VmTraceReader.kt
+++ b/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/vm/VmTraceReader.kt
@@ -89,23 +89,24 @@ class VmTraceReader(traceDirectory: File) : TraceReader<VmWorkload> {
vmId = vmFile.nameWithoutExtension.trim().toLong()
val timestamp = values[timestampCol].trim().toLong() - 5 * 60
cores = values[coreCol].trim().toInt()
- val cpuUsage = values[cpuUsageCol].trim().toDouble()
+ val cpuUsage = values[cpuUsageCol].trim().toDouble() // MHz
requiredMemory = (values[provisionedMemoryCol].trim().toDouble() / 1000).toLong()
- val flops: Long = (cpuUsage * cores * 1_000_000L * 5 * 60).toLong()
+ val flops: Long = (cpuUsage * 1_000_000L * 5 * 60 * cores).toLong()
if (flopsHistory.isEmpty()) {
- flopsHistory.add(FlopsHistoryFragment(timestamp, flops, traceInterval))
+ flopsHistory.add(FlopsHistoryFragment(timestamp, flops, traceInterval, cpuUsage))
} else {
if (flopsHistory.last().flops != flops) {
- flopsHistory.add(FlopsHistoryFragment(timestamp, flops, traceInterval))
+ flopsHistory.add(FlopsHistoryFragment(timestamp, flops, traceInterval, cpuUsage))
} else {
val oldFragment = flopsHistory.removeAt(flopsHistory.size - 1)
flopsHistory.add(
FlopsHistoryFragment(
oldFragment.tick,
oldFragment.flops + flops,
- oldFragment.duration + traceInterval
+ oldFragment.duration + traceInterval,
+ cpuUsage
)
)
}