diff options
| author | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2020-04-15 12:16:42 +0200 |
|---|---|---|
| committer | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2020-04-15 12:16:42 +0200 |
| commit | a77829c7a8cf300a99a695423d85f905e0209286 (patch) | |
| tree | f31200cdc3f108ea9b6d622df44a972ed5eed46d /opendc/opendc-experiments-sc20/src | |
| parent | ae23970faa77c89408a4e98cb9259fb53e222bd3 (diff) | |
perf: Optimize performance interference
Diffstat (limited to 'opendc/opendc-experiments-sc20/src')
2 files changed, 24 insertions, 10 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 02a982dc..464f4fc6 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 @@ -34,6 +34,10 @@ class Sc20Monitor( .name("hostState").type().stringType().noDefault() .name("hostUsage").type().doubleType().noDefault() .name("powerDraw").type().doubleType().noDefault() + .name("totalSubmittedVms").type().longType().noDefault() + .name("totalQueuedVms").type().longType().noDefault() + .name("totalRunningVms").type().longType().noDefault() + .name("totalFinishedVms").type().longType().noDefault() .endRecord() private val writer = AvroParquetWriter.builder<GenericData.Record>(Path(destination)) .withSchema(schema) @@ -58,6 +62,10 @@ class Sc20Monitor( 0.0, 0, server, + 0, + 0, + 0, + 0, duration ) } @@ -77,6 +85,10 @@ class Sc20Monitor( cpuDemand: Double, numberOfDeployedImages: Int, hostServer: Server, + submittedVms: Long, + queuedVms: Long, + runningVms: Long, + finishedVms: Long, duration: Long = 5 * 60 * 1000L ) { // Assume for now that the host is not virtualized and measure the current power draw @@ -98,6 +110,10 @@ class Sc20Monitor( record.put("hostState", hostServer.state) record.put("hostUsage", usage) record.put("powerDraw", powerDraw) + record.put("totalSubmittedVms", submittedVms) + record.put("totalQueuedVms", queuedVms) + record.put("totalRunningVms", runningVms) + record.put("totalFinishedVms", finishedVms) writer.write(record) } diff --git a/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/TestExperiment.kt b/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/TestExperiment.kt index f3b5061c..08815720 100644 --- a/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/TestExperiment.kt +++ b/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/TestExperiment.kt @@ -204,7 +204,11 @@ fun main(args: Array<String>) { event.cpuUsage, event.cpuDemand, event.numberOfDeployedImages, - event.hostServer + event.hostServer, + scheduler.submittedVms, + scheduler.queuedVms, + scheduler.runningVms, + scheduler.finishedVms ) } } @@ -229,15 +233,14 @@ fun main(args: Array<String>) { null } + var submitted = 0L val finish = Channel<Unit>(Channel.RENDEZVOUS) - var submitted = 0 - var finished = 0 val reader = Sc20TraceReader(File(traceDirectory), performanceInterferenceModel, getSelectedVmList()) while (reader.hasNext()) { val (time, workload) = reader.next() - delay(max(0, time - simulationContext.clock.millis())) submitted++ + delay(max(0, time - simulationContext.clock.millis())) launch { chan.send(Unit) val server = scheduler.deploy( @@ -250,12 +253,7 @@ fun main(args: Array<String>) { if (it is ServerEvent.StateChanged) monitor.onVmStateChanged(it.server) - // Detect whether the VM has finished running - if (it.server.state == ServerState.SHUTOFF) { - finished++ - } - - if (finished == submitted && !reader.hasNext()) { + if (scheduler.submittedVms == submitted && scheduler.runningVms <= 1 && !reader.hasNext()) { finish.send(Unit) } } |
