From 78417251806e079c998380a76ab3533de373289b Mon Sep 17 00:00:00 2001 From: Georgios Andreadis Date: Mon, 2 Mar 2020 13:15:11 +0100 Subject: [ci skip] Add performance interference model start --- .../core/workload/PerformanceInterferenceModel.kt | 50 ++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/workload/PerformanceInterferenceModel.kt (limited to 'opendc/opendc-core/src') 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 new file mode 100644 index 00000000..310b3a27 --- /dev/null +++ b/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/workload/PerformanceInterferenceModel.kt @@ -0,0 +1,50 @@ +package com.atlarge.opendc.core.workload + +import java.util.UUID + +/** + * Performance Interference Model describing the variability incurred by different sets of workloads if colocated. + * + * @param items The [PerformanceInterferenceModelItem]s that make up this model. + */ +data class PerformanceInterferenceModel( + val items: Set +) { + fun apply(colocatedWorkloads: Set): Double { + val intersectingItems = items.filter { item -> + colocatedWorkloads.map { it.uid }.intersect(item.workloadIds).size > 1 + } + + if (intersectingItems.isEmpty()) { + return 1.0 + } + return intersectingItems.map { it.performanceScore }.min() ?: error("Minimum score must exist.") + } +} + +/** + * Model describing how a specific set of workloads causes performance variability for each workload. + * + * @param workloadIds The IDs of the workloads that together cause performance variability for each workload in the set. + * @param performanceScore The performance score that should be applied to each workload's performance. 1 means no + * influence, <1 means that performance degrades, and >1 means that performance improves. + */ +data class PerformanceInterferenceModelItem( + val workloadIds: Set, + val performanceScore: Double +) { + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (javaClass != other?.javaClass) return false + + other as PerformanceInterferenceModelItem + + if (workloadIds != other.workloadIds) return false + + return true + } + + override fun hashCode(): Int { + return workloadIds.hashCode() + } +} -- cgit v1.2.3