Skip to content

Commit

Permalink
Metric update (#205)
Browse files Browse the repository at this point in the history
* Updated metrics to consistently be ms

* Updated metrics to consistently be ms

* Updated metric documentation on the site

* Updated some tests to work with the updated metrics
  • Loading branch information
DanteNiewenhuis authored Feb 16, 2024
1 parent 29f3fd2 commit d28002a
Show file tree
Hide file tree
Showing 10 changed files with 147 additions and 163 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -248,10 +248,10 @@ public class SimHost(
counters.sync()

return HostCpuStats(
counters.cpuActiveTime / 1000L,
counters.cpuIdleTime / 1000L,
counters.cpuStealTime / 1000L,
counters.cpuLostTime / 1000L,
counters.cpuActiveTime,
counters.cpuIdleTime,
counters.cpuStealTime,
counters.cpuLostTime,
hypervisor.cpuCapacity,
hypervisor.cpuDemand,
hypervisor.cpuUsage,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ internal class SimHostTest {
val cpuStats = host.getCpuStats()

assertAll(
{ assertEquals(639, cpuStats.activeTime, "Active time does not match") },
{ assertEquals(2360, cpuStats.idleTime, "Idle time does not match") },
{ assertEquals(56, cpuStats.stealTime, "Steal time does not match") },
{ assertEquals(639564, cpuStats.activeTime, "Active time does not match") },
{ assertEquals(2360433, cpuStats.idleTime, "Idle time does not match") },
{ assertEquals(56251, cpuStats.stealTime, "Steal time does not match") },
{ assertEquals(1499999, timeSource.millis()) }
)
}
Expand Down Expand Up @@ -215,9 +215,9 @@ internal class SimHostTest {
val cpuStats = host.getCpuStats()

assertAll(
{ assertEquals(658, cpuStats.activeTime, "Active time does not match") },
{ assertEquals(2341, cpuStats.idleTime, "Idle time does not match") },
{ assertEquals(637, cpuStats.stealTime, "Steal time does not match") },
{ assertEquals(658502, cpuStats.activeTime, "Active time does not match") },
{ assertEquals(2341496, cpuStats.idleTime, "Idle time does not match") },
{ assertEquals(637504, cpuStats.stealTime, "Steal time does not match") },
{ assertEquals(1499999, timeSource.millis()) }
)
}
Expand Down Expand Up @@ -287,8 +287,8 @@ internal class SimHostTest {
val guestSysStats = host.getSystemStats(server)

assertAll(
{ assertEquals(1770, cpuStats.idleTime, "Idle time does not match") },
{ assertEquals(639, cpuStats.activeTime, "Active time does not match") },
{ assertEquals(1770344, cpuStats.idleTime, "Idle time does not match") },
{ assertEquals(639653, cpuStats.activeTime, "Active time does not match") },
{ assertEquals(1204999, sysStats.uptime.toMillis(), "Uptime does not match") },
{ assertEquals(300000, sysStats.downtime.toMillis(), "Downtime does not match") },
{ assertEquals(1204999, guestSysStats.uptime.toMillis(), "Guest uptime does not match") },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public class ParquetHostDataWriter(path: File, bufferSize: Int) :
.addFields(
Types
.required(PrimitiveType.PrimitiveTypeName.INT64)
.`as`(LogicalTypeAnnotation.timestampType(true, LogicalTypeAnnotation.TimeUnit.MILLIS))
// .`as`(LogicalTypeAnnotation.timestampType(true, LogicalTypeAnnotation.TimeUnit.MILLIS))
.named("timestamp"),
Types
.required(PrimitiveType.PrimitiveTypeName.BINARY)
Expand Down Expand Up @@ -232,7 +232,7 @@ public class ParquetHostDataWriter(path: File, bufferSize: Int) :
.named("downtime"),
Types
.optional(PrimitiveType.PrimitiveTypeName.INT64)
.`as`(LogicalTypeAnnotation.timestampType(true, LogicalTypeAnnotation.TimeUnit.MILLIS))
// .`as`(LogicalTypeAnnotation.timestampType(true, LogicalTypeAnnotation.TimeUnit.MILLIS))
.named("boot_time")
)
.named("host")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public class ParquetServerDataWriter(path: File, bufferSize: Int) :
.addFields(
Types
.required(PrimitiveType.PrimitiveTypeName.INT64)
.`as`(LogicalTypeAnnotation.timestampType(true, LogicalTypeAnnotation.TimeUnit.MILLIS))
// .`as`(LogicalTypeAnnotation.timestampType(true, LogicalTypeAnnotation.TimeUnit.MILLIS))
.named("timestamp"),
Types
.required(PrimitiveType.PrimitiveTypeName.BINARY)
Expand Down Expand Up @@ -195,11 +195,11 @@ public class ParquetServerDataWriter(path: File, bufferSize: Int) :
.named("downtime"),
Types
.optional(PrimitiveType.PrimitiveTypeName.INT64)
.`as`(LogicalTypeAnnotation.timestampType(true, LogicalTypeAnnotation.TimeUnit.MILLIS))
// .`as`(LogicalTypeAnnotation.timestampType(true, LogicalTypeAnnotation.TimeUnit.MILLIS))
.named("provision_time"),
Types
.optional(PrimitiveType.PrimitiveTypeName.INT64)
.`as`(LogicalTypeAnnotation.timestampType(true, LogicalTypeAnnotation.TimeUnit.MILLIS))
// .`as`(LogicalTypeAnnotation.timestampType(true, LogicalTypeAnnotation.TimeUnit.MILLIS))
.named("boot_time")

)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ package org.opendc.compute.telemetry.export.parquet
import org.apache.hadoop.conf.Configuration
import org.apache.parquet.hadoop.api.WriteSupport
import org.apache.parquet.io.api.RecordConsumer
import org.apache.parquet.schema.LogicalTypeAnnotation
import org.apache.parquet.schema.MessageType
import org.apache.parquet.schema.PrimitiveType
import org.apache.parquet.schema.Types
Expand Down Expand Up @@ -102,7 +101,7 @@ public class ParquetServiceDataWriter(path: File, bufferSize: Int) :
.addFields(
Types
.required(PrimitiveType.PrimitiveTypeName.INT64)
.`as`(LogicalTypeAnnotation.timestampType(true, LogicalTypeAnnotation.TimeUnit.MILLIS))
// .`as`(LogicalTypeAnnotation.timestampType(true, LogicalTypeAnnotation.TimeUnit.MILLIS))
.named("timestamp"),
Types
.required(PrimitiveType.PrimitiveTypeName.INT32)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,22 +84,22 @@ public interface HostTableReader {
public val cpuUtilization: Double

/**
* The duration (in seconds) that a CPU was active in the host.
* The duration (in ms) that a CPU was active in the host.
*/
public val cpuActiveTime: Long

/**
* The duration (in seconds) that a CPU was idle in the host.
* The duration (in ms) that a CPU was idle in the host.
*/
public val cpuIdleTime: Long

/**
* The duration (in seconds) that a vCPU wanted to run, but no capacity was available.
* The duration (in ms) that a vCPU wanted to run, but no capacity was available.
*/
public val cpuStealTime: Long

/**
* The duration (in seconds) of CPU time that was lost due to interference.
* The duration (in ms) of CPU time that was lost due to interference.
*/
public val cpuLostTime: Long

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ class CapelinIntegrationTest {
{ assertEquals(0, monitor.serversActive, "All VMs should finish after a run") },
{ assertEquals(0, monitor.attemptsFailure, "No VM should be unscheduled") },
{ assertEquals(0, monitor.serversPending, "No VM should not be in the queue") },
{ assertEquals(223379987, monitor.idleTime) { "Incorrect idle time" } },
{ assertEquals(66977088, monitor.activeTime) { "Incorrect active time" } },
{ assertEquals(3160266, monitor.stealTime) { "Incorrect steal time" } },
{ assertEquals(223379991650, monitor.idleTime) { "Incorrect idle time" } },
{ assertEquals(66977091124, monitor.activeTime) { "Incorrect active time" } },
{ assertEquals(3160267873, monitor.stealTime) { "Incorrect steal time" } },
{ assertEquals(0, monitor.lostTime) { "Incorrect lost time" } },
{ assertEquals(5.8407E9, monitor.energyUsage, 1E4) { "Incorrect power draw" } }
)
Expand Down Expand Up @@ -160,9 +160,9 @@ class CapelinIntegrationTest {

// Note that these values have been verified beforehand
assertAll(
{ assertEquals(10996730, monitor.idleTime) { "Idle time incorrect" } },
{ assertEquals(9741285, monitor.activeTime) { "Active time incorrect" } },
{ assertEquals(0, monitor.stealTime) { "Steal time incorrect" } },
{ assertEquals(10996730092, monitor.idleTime) { "Idle time incorrect" } },
{ assertEquals(9741285381, monitor.activeTime) { "Active time incorrect" } },
{ assertEquals(152, monitor.stealTime) { "Steal time incorrect" } },
{ assertEquals(0, monitor.lostTime) { "Lost time incorrect" } },
{ assertEquals(7.0109E8, monitor.energyUsage, 1E4) { "Incorrect power draw" } }
)
Expand Down Expand Up @@ -199,10 +199,10 @@ class CapelinIntegrationTest {

// Note that these values have been verified beforehand
assertAll(
{ assertEquals(42814948, monitor.idleTime) { "Idle time incorrect" } },
{ assertEquals(40138266, monitor.activeTime) { "Active time incorrect" } },
{ assertEquals(23489356, monitor.stealTime) { "Steal time incorrect" } },
{ assertEquals(424267, monitor.lostTime) { "Lost time incorrect" } }
{ assertEquals(42814948316, monitor.idleTime) { "Idle time incorrect" } },
{ assertEquals(40138266225, monitor.activeTime) { "Active time incorrect" } },
{ assertEquals(23489356981, monitor.stealTime) { "Steal time incorrect" } },
{ assertEquals(424267131, monitor.lostTime) { "Lost time incorrect" } }
)
}

Expand All @@ -229,9 +229,9 @@ class CapelinIntegrationTest {

// Note that these values have been verified beforehand
assertAll(
{ assertEquals(1404277, monitor.idleTime) { "Idle time incorrect" } },
{ assertEquals(1478675, monitor.activeTime) { "Active time incorrect" } },
{ assertEquals(0, monitor.stealTime) { "Steal time incorrect" } },
{ assertEquals(1404277711, monitor.idleTime) { "Idle time incorrect" } },
{ assertEquals(1478675712, monitor.activeTime) { "Active time incorrect" } },
{ assertEquals(152, monitor.stealTime) { "Steal time incorrect" } },
{ assertEquals(0, monitor.lostTime) { "Lost time incorrect" } },
{ assertEquals(360369187, monitor.uptime) { "Uptime incorrect" } }
)
Expand Down
Loading

0 comments on commit d28002a

Please sign in to comment.