diff options
| author | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2020-04-03 20:50:33 +0200 |
|---|---|---|
| committer | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2020-04-03 20:50:33 +0200 |
| commit | 1f67deb18d1430931aec955e7c129cb0d714718c (patch) | |
| tree | ce62c5f919fb45e7bf00800bab86defb3521a18c | |
| parent | 843a22e09f32f498d7d5b4782b54c5639375ee20 (diff) | |
feat: Report hypervisor state every slice
| -rw-r--r-- | opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/Sc20Monitor.kt | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/Sc20Monitor.kt b/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/Sc20Monitor.kt index 120c4f81..212b1bfb 100644 --- a/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/Sc20Monitor.kt +++ b/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/Sc20Monitor.kt @@ -14,18 +14,13 @@ class Sc20Monitor( destination: String ) : Closeable { private val outputFile = BufferedWriter(FileWriter(destination)) - private var failedInSlice: Int = 0 private val lastServerStates = mutableMapOf<Server, Pair<ServerState, Long>>() init { - outputFile.write("time,duration,requestedBurst,grantedBurst,numberOfDeployedImages,server,hostUsage,powerDraw,failedVms\n") + outputFile.write("time,duration,requestedBurst,grantedBurst,numberOfDeployedImages,server,hostState,hostUsage,powerDraw,failedVms\n") } - suspend fun onVmStateChanged(server: Server) { - if (server.state == ServerState.ERROR) { - failedInSlice++ - } - } + suspend fun onVmStateChanged(server: Server) {} suspend fun serverStateChanged(driver: VirtDriver, server: Server) { if ((server.state == ServerState.SHUTOFF || server.state == ServerState.ERROR) && @@ -61,12 +56,8 @@ class Sc20Monitor( val driver = hostServer.services[BareMetalDriver.Key] val usage = driver.usage.first() val powerDraw = driver.powerDraw.first() - val failed = if (failedInSlice > 0) { - failedInSlice.also { failedInSlice = 0 } - } else { - 0 - } - outputFile.write("$time,$duration,$requestedBurst,$grantedBurst,$numberOfDeployedImages,${hostServer.uid},$usage,$powerDraw,$failed") + + outputFile.write("$time,$duration,$requestedBurst,$grantedBurst,$numberOfDeployedImages,${hostServer.uid},${hostServer.state},$usage,$powerDraw") outputFile.newLine() } |
