summaryrefslogtreecommitdiff
path: root/opendc/opendc-format/src
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2020-03-09 20:55:45 +0100
committerFabian Mastenbroek <mail.fabianm@gmail.com>2020-03-09 20:55:45 +0100
commit2dd2bfe87bcbe368f46ce8e975ccccbfac2c0560 (patch)
tree8880b748cb5918ee2523c6859c6e77f98b75076e /opendc/opendc-format/src
parentfa7455ac6aaa1e0c34a4218c32423d544373e795 (diff)
parent0930e73c319ecd01ecdae47e15f077555c12db0c (diff)
Merge branch 'feat/2.x-perf-interference' into '2.x'
Implement a basic performance interference model Closes #50 See merge request opendc/opendc-simulator!33
Diffstat (limited to 'opendc/opendc-format/src')
-rw-r--r--opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/PerformanceInterferenceModelReader.kt38
-rw-r--r--opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/sc20/PerformanceInterferenceEntry.kt6
-rw-r--r--opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/sc20/Sc20PerformanceInterferenceReader.kt61
-rw-r--r--opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/vm/VmTraceReader.kt22
4 files changed, 125 insertions, 2 deletions
diff --git a/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/PerformanceInterferenceModelReader.kt b/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/PerformanceInterferenceModelReader.kt
new file mode 100644
index 00000000..f9ebba3d
--- /dev/null
+++ b/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/PerformanceInterferenceModelReader.kt
@@ -0,0 +1,38 @@
+/*
+ * MIT License
+ *
+ * Copyright (c) 2019 atlarge-research
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package com.atlarge.opendc.format.trace
+
+import com.atlarge.opendc.core.workload.PerformanceInterferenceModel
+import java.io.Closeable
+
+/**
+ * An interface for reading descriptions of performance interference models into memory.
+ */
+interface PerformanceInterferenceModelReader : Closeable {
+ /**
+ * Construct a [PerformanceInterferenceModel].
+ */
+ fun construct(): PerformanceInterferenceModel
+}
diff --git a/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/sc20/PerformanceInterferenceEntry.kt b/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/sc20/PerformanceInterferenceEntry.kt
new file mode 100644
index 00000000..1eeecb25
--- /dev/null
+++ b/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/sc20/PerformanceInterferenceEntry.kt
@@ -0,0 +1,6 @@
+package com.atlarge.opendc.format.trace.sc20
+
+internal data class PerformanceInterferenceEntry(
+ val vms: List<String>,
+ val performanceScore: Double
+)
diff --git a/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/sc20/Sc20PerformanceInterferenceReader.kt b/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/sc20/Sc20PerformanceInterferenceReader.kt
new file mode 100644
index 00000000..b2d60bb9
--- /dev/null
+++ b/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/sc20/Sc20PerformanceInterferenceReader.kt
@@ -0,0 +1,61 @@
+/*
+ * MIT License
+ *
+ * Copyright (c) 2019 atlarge-research
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package com.atlarge.opendc.format.trace.sc20
+
+import com.atlarge.opendc.core.workload.PerformanceInterferenceModel
+import com.atlarge.opendc.core.workload.PerformanceInterferenceModelItem
+import com.atlarge.opendc.format.trace.PerformanceInterferenceModelReader
+import com.fasterxml.jackson.databind.ObjectMapper
+import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
+import com.fasterxml.jackson.module.kotlin.readValue
+import java.io.InputStream
+import java.util.UUID
+
+/**
+ * A parser for the JSON performance interference setup files used for the SC20 paper.
+ *
+ * @param input The input stream to read from.
+ * @param mapper The Jackson object mapper to use.
+ */
+class Sc20PerformanceInterferenceReader(input: InputStream, mapper: ObjectMapper = jacksonObjectMapper()) :
+ PerformanceInterferenceModelReader {
+ /**
+ * The environment that was read from the file.
+ */
+ private val performanceInterferenceModel: List<PerformanceInterferenceEntry> = mapper.readValue(input)
+
+ override fun construct(): PerformanceInterferenceModel {
+ return PerformanceInterferenceModel(
+ performanceInterferenceModel.map { item ->
+ PerformanceInterferenceModelItem(
+ item.vms.map { name -> UUID(0L, name.toLong()) }.toSet(),
+ item.performanceScore
+ )
+ }.toSet()
+ )
+ }
+
+ override fun close() {}
+}
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 2e881a6c..2adf99b1 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
@@ -28,6 +28,8 @@ import com.atlarge.opendc.compute.core.image.FlopsHistoryFragment
import com.atlarge.opendc.compute.core.image.VmImage
import com.atlarge.opendc.compute.core.workload.VmWorkload
import com.atlarge.opendc.core.User
+import com.atlarge.opendc.core.workload.IMAGE_PERF_INTERFERENCE_MODEL
+import com.atlarge.opendc.core.workload.PerformanceInterferenceModel
import com.atlarge.opendc.format.trace.TraceEntry
import com.atlarge.opendc.format.trace.TraceReader
import java.io.BufferedReader
@@ -39,8 +41,12 @@ import java.util.UUID
* A [TraceReader] for the VM workload trace format.
*
* @param traceDirectory The directory of the traces.
+ * @param performanceInterferenceModel The performance model covering the workload in the VM trace.
*/
-class VmTraceReader(traceDirectory: File) : TraceReader<VmWorkload> {
+class VmTraceReader(
+ traceDirectory: File,
+ performanceInterferenceModel: PerformanceInterferenceModel
+) : TraceReader<VmWorkload> {
/**
* The internal iterator to use for this reader.
*/
@@ -115,9 +121,21 @@ class VmTraceReader(traceDirectory: File) : TraceReader<VmWorkload> {
}
val uuid = UUID(0L, vmId)
+
+ val relevantPerformanceInterferenceModelItems = PerformanceInterferenceModel(
+ performanceInterferenceModel.items.filter { it.workloadIds.contains(uuid) }.toSet()
+ )
+
val vmWorkload = VmWorkload(
uuid, "VM Workload $vmId", UnnamedUser,
- VmImage(uuid, vmId.toString(), emptyMap(), flopsHistory, cores, requiredMemory)
+ VmImage(
+ uuid,
+ vmId.toString(),
+ mapOf(IMAGE_PERF_INTERFERENCE_MODEL to relevantPerformanceInterferenceModelItems),
+ flopsHistory,
+ cores,
+ requiredMemory
+ )
)
entries[vmId] = TraceEntryImpl(
flopsHistory.firstOrNull()?.tick ?: -1,