diff options
| author | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2021-08-25 18:16:20 +0200 |
|---|---|---|
| committer | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2021-08-25 18:16:20 +0200 |
| commit | bb6066e1cecc55a50ac29da200bf3beba1ddd80b (patch) | |
| tree | a110cf5c2613dc9f558f5cea77483365d14bbf1d /opendc-experiments/opendc-experiments-capelin/src/main | |
| parent | e6dd553cf77445083f2c7632bd3b4c3611d76d0a (diff) | |
fix(capelin): Eliminate unnecessary double to long conversions
This change eliminates the unnecessary conversions from double to long
in the Capelin metric processing code.
Diffstat (limited to 'opendc-experiments/opendc-experiments-capelin/src/main')
3 files changed, 26 insertions, 26 deletions
diff --git a/opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/monitor/ExperimentMetricExporter.kt b/opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/monitor/ExperimentMetricExporter.kt index 16358817..be94593c 100644 --- a/opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/monitor/ExperimentMetricExporter.kt +++ b/opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/monitor/ExperimentMetricExporter.kt @@ -65,12 +65,12 @@ public class ExperimentMetricExporter( for ((id, hostMetric) in hostMetrics) { val lastHostMetric = lastHostMetrics.getOrDefault(id, hostMetricsSingleton) val host = hosts.getValue(id) - monitor.reportHostSlice( + monitor.reportHostData( clock.millis(), - (hostMetric.requestedBurst - lastHostMetric.requestedBurst).toLong(), - (hostMetric.grantedBurst - lastHostMetric.grantedBurst).toLong(), - (hostMetric.overcommissionedBurst - lastHostMetric.overcommissionedBurst).toLong(), - (hostMetric.interferedBurst - lastHostMetric.interferedBurst).toLong(), + hostMetric.requestedBurst - lastHostMetric.requestedBurst, + hostMetric.grantedBurst - lastHostMetric.grantedBurst, + hostMetric.overcommissionedBurst - lastHostMetric.overcommissionedBurst, + hostMetric.interferedBurst - lastHostMetric.interferedBurst, hostMetric.cpuUsage, hostMetric.cpuDemand, hostMetric.powerDraw, @@ -141,7 +141,7 @@ public class ExperimentMetricExporter( val hosts = metrics["hosts.total"]?.longSumData?.points?.last()?.value?.toInt() ?: 0 val availableHosts = metrics["hosts.available"]?.longSumData?.points?.last()?.value?.toInt() ?: 0 - monitor.reportProvisionerMetrics( + monitor.reportServiceData( clock.millis(), hosts, availableHosts, diff --git a/opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/monitor/ExperimentMonitor.kt b/opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/monitor/ExperimentMonitor.kt index 79af88fe..9a4aec35 100644 --- a/opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/monitor/ExperimentMonitor.kt +++ b/opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/monitor/ExperimentMonitor.kt @@ -44,23 +44,23 @@ public interface ExperimentMonitor : AutoCloseable { /** * This method is invoked for a host for each slice that is finishes. */ - public fun reportHostSlice( + public fun reportHostData( time: Long, - requestedBurst: Long, - grantedBurst: Long, - overcommissionedBurst: Long, - interferedBurst: Long, + totalWork: Double, + grantedWork: Double, + overcommittedWork: Double, + interferedWork: Double, cpuUsage: Double, cpuDemand: Double, powerDraw: Double, - numberOfDeployedImages: Int, + instanceCount: Int, host: Host ) {} /** - * This method is invoked for a provisioner event. + * This method is invoked for reporting service data. */ - public fun reportProvisionerMetrics( + public fun reportServiceData( time: Long, totalHostCount: Int, availableHostCount: Int, diff --git a/opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/monitor/ParquetExperimentMonitor.kt b/opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/monitor/ParquetExperimentMonitor.kt index d314c6f5..83351c41 100644 --- a/opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/monitor/ParquetExperimentMonitor.kt +++ b/opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/monitor/ParquetExperimentMonitor.kt @@ -57,16 +57,16 @@ public class ParquetExperimentMonitor(base: File, partition: String, bufferSize: logger.debug { "Host ${host.uid} changed state $newState [$time]" } } - override fun reportHostSlice( + override fun reportHostData( time: Long, - requestedBurst: Long, - grantedBurst: Long, - overcommissionedBurst: Long, - interferedBurst: Long, + totalWork: Double, + grantedWork: Double, + overcommittedWork: Double, + interferedWork: Double, cpuUsage: Double, cpuDemand: Double, powerDraw: Double, - numberOfDeployedImages: Int, + instanceCount: Int, host: Host ) { hostWriter.write( @@ -74,11 +74,11 @@ public class ParquetExperimentMonitor(base: File, partition: String, bufferSize: time, 5 * 60 * 1000L, host, - numberOfDeployedImages, - requestedBurst.toLong(), - grantedBurst.toLong(), - overcommissionedBurst.toLong(), - interferedBurst.toLong(), + instanceCount, + totalWork.toLong(), + grantedWork.toLong(), + overcommittedWork.toLong(), + interferedWork.toLong(), cpuUsage, cpuDemand, powerDraw, @@ -87,7 +87,7 @@ public class ParquetExperimentMonitor(base: File, partition: String, bufferSize: ) } - override fun reportProvisionerMetrics( + override fun reportServiceData( time: Long, totalHostCount: Int, availableHostCount: Int, |
