diff options
| author | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2021-04-08 12:31:34 +0200 |
|---|---|---|
| committer | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2021-04-08 12:33:10 +0200 |
| commit | 8deb1fbff56f9aee0b5f0114c026fb4e57d53f95 (patch) | |
| tree | cb24c4a1a9bde6d0e1011be2820f761337f33b9e /simulator/opendc-compute | |
| parent | 41ad2f2950550fcd95a599bd8869aa191c88396a (diff) | |
compute: Use BatchRecorder to emit metrics
This change updates the SimHost implementation to use BatchRecorder to
batch record multiple metrics at once.
Diffstat (limited to 'simulator/opendc-compute')
| -rw-r--r-- | simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/SimHost.kt | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/SimHost.kt b/simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/SimHost.kt index 89d01c57..7a0f8bc7 100644 --- a/simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/SimHost.kt +++ b/simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/SimHost.kt @@ -98,13 +98,15 @@ public class SimHost( cpuUsage: Double, cpuDemand: Double ) { - _cpuWork.record(requestedWork.toDouble()) - _cpuWorkGranted.record(grantedWork.toDouble()) - _cpuWorkOvercommit.record(overcommittedWork.toDouble()) - _cpuWorkInterference.record(interferedWork.toDouble()) - _cpuUsage.record(cpuUsage) - _cpuDemand.record(cpuDemand) - _cpuPower.record(machine.powerDraw) + + _batch.put(_cpuWork, requestedWork.toDouble()) + _batch.put(_cpuWorkGranted, grantedWork.toDouble()) + _batch.put(_cpuWorkOvercommit, overcommittedWork.toDouble()) + _batch.put(_cpuWorkInterference, interferedWork.toDouble()) + _batch.put(_cpuUsage, cpuUsage) + _batch.put(_cpuDemand, cpuDemand) + _batch.put(_cpuPower, machine.powerDraw) + _batch.record() } } ) @@ -151,7 +153,6 @@ public class SimHost( .setDescription("The amount of CPU resources used by the host") .setUnit("MHz") .build() - .bind(Labels.of("host", uid.toString())) /** * The CPU demand on the host. @@ -160,7 +161,6 @@ public class SimHost( .setDescription("The amount of CPU resources the guests would use if there were no CPU contention or CPU limits") .setUnit("MHz") .build() - .bind(Labels.of("host", uid.toString())) /** * The requested work for the CPU. @@ -169,7 +169,6 @@ public class SimHost( .setDescription("The amount of power used by the CPU") .setUnit("W") .build() - .bind(Labels.of("host", uid.toString())) /** * The requested work for the CPU. @@ -178,7 +177,6 @@ public class SimHost( .setDescription("The amount of work supplied to the CPU") .setUnit("1") .build() - .bind(Labels.of("host", uid.toString())) /** * The work actually performed by the CPU. @@ -187,7 +185,6 @@ public class SimHost( .setDescription("The amount of work performed by the CPU") .setUnit("1") .build() - .bind(Labels.of("host", uid.toString())) /** * The work that could not be performed by the CPU due to overcommitting resource. @@ -196,7 +193,6 @@ public class SimHost( .setDescription("The amount of work not performed by the CPU due to overcommitment") .setUnit("1") .build() - .bind(Labels.of("host", uid.toString())) /** * The work that could not be performed by the CPU due to interference. @@ -205,7 +201,11 @@ public class SimHost( .setDescription("The amount of work not performed by the CPU due to interference") .setUnit("1") .build() - .bind(Labels.of("host", uid.toString())) + + /** + * The batch recorder used to record multiple metrics atomically. + */ + private val _batch = meter.newBatchRecorder("host", uid.toString()) init { // Launch hypervisor onto machine |
