diff options
| author | Georgios Andreadis <info@gandreadis.com> | 2020-04-01 18:32:04 +0200 |
|---|---|---|
| committer | Georgios Andreadis <info@gandreadis.com> | 2020-04-01 18:32:04 +0200 |
| commit | 896c6e2fa2cb84be2f383b39bf81c40101647694 (patch) | |
| tree | ea9d927e9e0678aef014156a95168570494fa924 /opendc/opendc-core | |
| parent | c4493dfef3daca816378760f7abf6ed0d2475099 (diff) | |
Optimizes the performance interference model logic
Credits to Fabian for the idea!
Diffstat (limited to 'opendc/opendc-core')
| -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 } |
