diff options
| author | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2020-04-03 14:02:48 +0200 |
|---|---|---|
| committer | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2020-04-03 14:02:48 +0200 |
| commit | a625066b997cfeeb31c88dddeb17fc67ea75d6e6 (patch) | |
| tree | 4fbe33316cfd6a5fff3903475aedab201c2eed7c /opendc/opendc-core/src/main | |
| parent | c4493dfef3daca816378760f7abf6ed0d2475099 (diff) | |
| parent | 2da0b5bfc37febca2183374f74eece0b230f054e (diff) | |
Merge branch '2.x-perf-interf-optimization' into '2.x'
Optimize the performance interference model
See merge request opendc/opendc-simulator!50
Diffstat (limited to 'opendc/opendc-core/src/main')
| -rw-r--r-- | opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/workload/PerformanceInterferenceModel.kt | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/workload/PerformanceInterferenceModel.kt b/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/workload/PerformanceInterferenceModel.kt index e2032ff1..ea110934 100644 --- a/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/workload/PerformanceInterferenceModel.kt +++ b/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/workload/PerformanceInterferenceModel.kt @@ -16,12 +16,16 @@ const val IMAGE_PERF_INTERFERENCE_MODEL = "image:performance-interference" data class PerformanceInterferenceModel( val items: Set<PerformanceInterferenceModelItem> ) { - fun apply(colocatedWorkloads: Set<Resource>, currentServerLoad: Double): Double { + private var intersectingItems: List<PerformanceInterferenceModelItem> = emptyList() + + fun computeIntersectingItems(colocatedWorkloads: Set<Resource>) { val colocatedWorkloadIds = colocatedWorkloads.map { it.name } - val intersectingItems = items.filter { item -> + intersectingItems = items.filter { item -> colocatedWorkloadIds.intersect(item.workloadNames).size > 1 } + } + fun apply(currentServerLoad: Double): Double { if (intersectingItems.isEmpty()) { return 1.0 } |
