summaryrefslogtreecommitdiffstats
path: root/node-admin/src/main
diff options
context:
space:
mode:
authorValerij Fredriksen <valerijf@verizonmedia.com>2019-06-21 14:58:20 +0200
committerValerij Fredriksen <valerijf@verizonmedia.com>2019-06-21 14:58:20 +0200
commit05b97d110229d5633b733b29fb93c785c8256346 (patch)
tree8889ec6a189e0e014f54ccc7384b7b91761eeaec /node-admin/src/main
parentecf4464a633104d180fad9ca5da15baae36a8514 (diff)
Rename throttled_time to throttled_cpu_time and add new throttled_time
Diffstat (limited to 'node-admin/src/main')
-rw-r--r--node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImpl.java41
1 files changed, 28 insertions, 13 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 5ca02f82aa5..3a9eae45607 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
@@ -546,7 +546,8 @@ public class NodeAgentImpl implements NodeAgent {
final double allocatedCpuRatio = node.vcpus() / totalNumCpuCores;
double cpuUsageRatioOfAllocated = lastCpuMetric.getCpuUsageRatio() / allocatedCpuRatio;
double cpuKernelUsageRatioOfAllocated = lastCpuMetric.getCpuKernelUsageRatio() / allocatedCpuRatio;
- Long cpuThrottledTime = lastCpuMetric.getThrottledTime();
+ double cpuThrottledTime = lastCpuMetric.getThrottledTime();
+ double cpuThrottledCpuTime = lastCpuMetric.getThrottledCpuTime();
long memoryTotalBytesUsed = memoryTotalBytesUsage - memoryTotalBytesCache;
double memoryUsageRatio = (double) memoryTotalBytesUsed / memoryTotalBytes;
@@ -562,7 +563,8 @@ public class NodeAgentImpl implements NodeAgent {
.withMetric("mem_total.util", 100 * memoryTotalUsageRatio)
.withMetric("cpu.util", 100 * cpuUsageRatioOfAllocated)
.withMetric("cpu.sys.util", 100 * cpuKernelUsageRatioOfAllocated)
- .withMetric("cpu.throttled_time.ns", cpuThrottledTime)
+ .withMetric("cpu.throttled_time", cpuThrottledTime)
+ .withMetric("cpu.throttled_cpu_time", cpuThrottledCpuTime)
.withMetric("cpu.vcpus", node.vcpus())
.withMetric("disk.limit", diskTotalBytes);
@@ -620,26 +622,35 @@ public class NodeAgentImpl implements NodeAgent {
}
class CpuUsageReporter {
+ private static final double BILLION = 1_000_000_000d;
private long containerKernelUsage = 0;
private long totalContainerUsage = 0;
private long totalSystemUsage = 0;
private long throttledTime = 0;
+ private long throttlingActivePeriods = 0;
+ private long throttledPeriods = 0;
private long deltaContainerKernelUsage;
private long deltaContainerUsage;
private long deltaSystemUsage;
private long deltaThrottledTime;
+ private long deltaThrottlingActivePeriods;
+ private long deltaThrottledPeriods;
private void updateCpuDeltas(ContainerStats.CpuStats cpuStats) {
- deltaSystemUsage = this.totalSystemUsage == 0 ? 0 : (cpuStats.getSystemCpuUsage() - this.totalSystemUsage);
- deltaContainerUsage = cpuStats.getTotalUsage() - this.totalContainerUsage;
- deltaContainerKernelUsage = cpuStats.getUsageInKernelMode() - this.containerKernelUsage;
- deltaThrottledTime = cpuStats.getThrottledTime() - this.throttledTime;
-
- this.totalSystemUsage = cpuStats.getSystemCpuUsage();
- this.totalContainerUsage = cpuStats.getTotalUsage();
- this.containerKernelUsage = cpuStats.getUsageInKernelMode();
- this.throttledTime = cpuStats.getThrottledTime();
+ deltaSystemUsage = totalSystemUsage == 0 ? 0 : (cpuStats.getSystemCpuUsage() - totalSystemUsage);
+ deltaContainerUsage = cpuStats.getTotalUsage() - totalContainerUsage;
+ deltaContainerKernelUsage = cpuStats.getUsageInKernelMode() - containerKernelUsage;
+ deltaThrottledTime = cpuStats.getThrottledTime() - throttledTime;
+ deltaThrottlingActivePeriods = cpuStats.getThrottlingActivePeriods() - throttlingActivePeriods;
+ deltaThrottledPeriods = cpuStats.getThrottledPeriods() - throttledPeriods;
+
+ totalSystemUsage = cpuStats.getSystemCpuUsage();
+ totalContainerUsage = cpuStats.getTotalUsage();
+ containerKernelUsage = cpuStats.getUsageInKernelMode();
+ throttledTime = cpuStats.getThrottledTime();
+ throttlingActivePeriods = cpuStats.getThrottlingActivePeriods();
+ throttledPeriods = cpuStats.getThrottledPeriods();
}
/**
@@ -655,8 +666,12 @@ public class NodeAgentImpl implements NodeAgent {
return deltaSystemUsage == 0 ? Double.NaN : (double) deltaContainerKernelUsage / deltaSystemUsage;
}
- Long getThrottledTime() {
- return deltaSystemUsage == 0 ? null : deltaThrottledTime;
+ double getThrottledTime() {
+ return deltaSystemUsage == 0 ? Double.NaN : 60d * deltaThrottledPeriods / deltaThrottlingActivePeriods;
+ }
+
+ double getThrottledCpuTime() {
+ return deltaSystemUsage == 0 ? Double.NaN : deltaThrottledTime / BILLION;
}
}