diff options
author | Valerij Fredriksen <valerijf@verizonmedia.com> | 2019-06-21 15:49:35 +0200 |
---|---|---|
committer | Valerij Fredriksen <valerijf@verizonmedia.com> | 2019-06-21 15:49:35 +0200 |
commit | 1e55ec0a0e4c42ea9f6b6d0468bb848696b5255a (patch) | |
tree | 9ba2df43dda45275a0115d3f21d802960f7e740b /node-admin | |
parent | 05b97d110229d5633b733b29fb93c785c8256346 (diff) |
Add javadoc and simplify method
Diffstat (limited to 'node-admin')
-rw-r--r-- | node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImpl.java | 5 | ||||
-rw-r--r-- | node-admin/src/test/resources/expected.container.system.metrics.txt | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImpl.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImpl.java index 3a9eae45607..4bf361e0e56 100644 --- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImpl.java +++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImpl.java @@ -623,6 +623,7 @@ public class NodeAgentImpl implements NodeAgent { class CpuUsageReporter { private static final double BILLION = 1_000_000_000d; + private static final double PERIOD_IN_SECONDS = ContainerResources.CPU_PERIOD_US / 1_000_000d; private long containerKernelUsage = 0; private long totalContainerUsage = 0; private long totalSystemUsage = 0; @@ -667,11 +668,11 @@ public class NodeAgentImpl implements NodeAgent { } double getThrottledTime() { - return deltaSystemUsage == 0 ? Double.NaN : 60d * deltaThrottledPeriods / deltaThrottlingActivePeriods; + return deltaThrottlingActivePeriods == 0 ? Double.NaN : deltaThrottledPeriods * PERIOD_IN_SECONDS; } double getThrottledCpuTime() { - return deltaSystemUsage == 0 ? Double.NaN : deltaThrottledTime / BILLION; + return deltaThrottlingActivePeriods == 0 ? Double.NaN : deltaThrottledTime / BILLION; } } diff --git a/node-admin/src/test/resources/expected.container.system.metrics.txt b/node-admin/src/test/resources/expected.container.system.metrics.txt index 4876466d8ca..9f32be2a0c9 100644 --- a/node-admin/src/test/resources/expected.container.system.metrics.txt +++ b/node-admin/src/test/resources/expected.container.system.metrics.txt @@ -11,7 +11,7 @@ s: "metrics": { "cpu.sys.util": 3.402, "cpu.throttled_cpu_time": 290.0, - "cpu.throttled_time": 49.473, + "cpu.throttled_time": 47.0, "cpu.util": 5.4, "cpu.vcpus": 2.0, "disk.limit": 250000000000, |