summaryrefslogtreecommitdiff
path: root/opendc/opendc-format/src
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2020-04-12 13:59:00 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2020-04-12 13:59:00 +0200
commit8d4d552e706ad5c5adebc774920337b4f201ac1f (patch)
treedb0332a19de49d5e4580bfd4f0ddfbc2ab887f18 /opendc/opendc-format/src
parent5f141c8b6aa6cfe96333f0cc02015e490b90fca6 (diff)
bug: Fix invalid FLOPs value for trace fragments
This change fixes the invalid FLOPs values for the trace fragments which were multiplied twice by the number of cores of the VM.
Diffstat (limited to 'opendc/opendc-format/src')
-rw-r--r--opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/sc20/Sc20TraceReader.kt16
1 files changed, 9 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..3688864f 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,13 @@ 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).toLong()
- val flops: Long = (cpuUsage * 5 * 60 * cores).toLong()
if (flopsHistory.isEmpty()) {
flopsHistory.add(FlopsHistoryFragment(timestamp, flops, traceInterval, cpuUsage, cores))
@@ -115,8 +118,7 @@ class Sc20TraceReader(
oldFragment.flops + flops,
oldFragment.duration + traceInterval,
cpuUsage,
- cores
- )
+ cores)
)
}
}
@@ -136,7 +138,7 @@ class Sc20TraceReader(
vmId,
mapOf(IMAGE_PERF_INTERFERENCE_MODEL to relevantPerformanceInterferenceModelItems),
flopsHistory,
- cores,
+ maxCores,
requiredMemory
)
)