diff options
| author | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2020-03-09 20:46:28 +0100 |
|---|---|---|
| committer | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2020-03-09 20:46:28 +0100 |
| commit | 0930e73c319ecd01ecdae47e15f077555c12db0c (patch) | |
| tree | 8880b748cb5918ee2523c6859c6e77f98b75076e /opendc/opendc-compute/src/main | |
| parent | 0f75b440d709f8a80efdb441d02b7bd47318a22c (diff) | |
feat: Define key for performance interference model of image
Diffstat (limited to 'opendc/opendc-compute/src/main')
| -rw-r--r-- | opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/driver/hypervisor/HypervisorVirtDriver.kt | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/driver/hypervisor/HypervisorVirtDriver.kt b/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/driver/hypervisor/HypervisorVirtDriver.kt index 006b31e1..6fe11c28 100644 --- a/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/driver/hypervisor/HypervisorVirtDriver.kt +++ b/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/driver/hypervisor/HypervisorVirtDriver.kt @@ -37,6 +37,7 @@ import com.atlarge.opendc.compute.core.monitor.ServerMonitor import com.atlarge.opendc.compute.virt.driver.VirtDriver import com.atlarge.opendc.compute.virt.driver.VirtDriverMonitor import com.atlarge.opendc.compute.virt.monitor.HypervisorMonitor +import com.atlarge.opendc.core.workload.IMAGE_PERF_INTERFERENCE_MODEL import com.atlarge.opendc.core.workload.PerformanceInterferenceModel import kotlinx.coroutines.CancellationException import kotlinx.coroutines.Job @@ -139,13 +140,9 @@ class HypervisorVirtDriver( val imagesRunning = vms.map { it.server.image }.toSet() for (vm in vms) { - var performanceScore = 1.0 - // Apply performance interference model - if (vm.server.image.tags.containsKey("performance-interference")) { - performanceScore = (vm.server.image.tags["performance-interference"] - as PerformanceInterferenceModel).apply(imagesRunning) - } + val performanceModel = vm.server.image.tags[IMAGE_PERF_INTERFERENCE_MODEL] as? PerformanceInterferenceModel? + val performanceScore = performanceModel?.apply(imagesRunning) ?: 1.0 for (i in 0 until min(vm.cpus.size, vm.requestedBurst.size)) { val cpu = vm.cpus[i] |
