summaryrefslogtreecommitdiff
path: root/opendc/opendc-compute/src
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2020-05-14 18:30:26 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2020-05-14 18:30:26 +0200
commit94e34d41eb384731333819a1dbe10539f9a5a14b (patch)
treebd79d33efa34161b884fa67e99f0190a9fc4bb71 /opendc/opendc-compute/src
parentbdf5982ec9977fd949efe7947a4ca36bba4dda85 (diff)
perf: Improve performance interference model construction performance
Diffstat (limited to 'opendc/opendc-compute/src')
-rw-r--r--opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/core/workload/PerformanceInterferenceModel.kt12
1 files changed, 11 insertions, 1 deletions
diff --git a/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/core/workload/PerformanceInterferenceModel.kt b/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/core/workload/PerformanceInterferenceModel.kt
index 45024a49..fab4ae9d 100644
--- a/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/core/workload/PerformanceInterferenceModel.kt
+++ b/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/core/workload/PerformanceInterferenceModel.kt
@@ -58,10 +58,20 @@ class PerformanceInterferenceModel(
lhs.hashCode().compareTo(rhs.hashCode())
}
val items = TreeSet(comparator)
+ val workloadToItem: Map<String, Set<PerformanceInterferenceModelItem>>
private val colocatedWorkloads = TreeSet<String>()
init {
- this.items.addAll(items)
+ val workloadToItem = mutableMapOf<String, MutableSet<PerformanceInterferenceModelItem>>()
+
+ for (item in items) {
+ for (workload in item.workloadNames) {
+ workloadToItem.getOrPut(workload) { mutableSetOf() }.add(item)
+ }
+ this.items.add(item)
+ }
+
+ this.workloadToItem = workloadToItem
}
fun vmStarted(server: Server) {