aboutsummaryrefslogtreecommitdiffstats
path: root/docker-api
diff options
context:
space:
mode:
authorValerij Fredriksen <valerijf@verizonmedia.com>2019-06-21 15:49:35 +0200
committerValerij Fredriksen <valerijf@verizonmedia.com>2019-06-21 15:49:35 +0200
commit1e55ec0a0e4c42ea9f6b6d0468bb848696b5255a (patch)
tree9ba2df43dda45275a0115d3f21d802960f7e740b /docker-api
parent05b97d110229d5633b733b29fb93c785c8256346 (diff)
Add javadoc and simplify method
Diffstat (limited to 'docker-api')
-rw-r--r--docker-api/src/main/java/com/yahoo/vespa/hosted/dockerapi/ContainerResources.java7
-rw-r--r--docker-api/src/main/java/com/yahoo/vespa/hosted/dockerapi/ContainerStats.java10
2 files changed, 12 insertions, 5 deletions
diff --git a/docker-api/src/main/java/com/yahoo/vespa/hosted/dockerapi/ContainerResources.java b/docker-api/src/main/java/com/yahoo/vespa/hosted/dockerapi/ContainerResources.java
index 70ba58cd9cf..bd8ffb0163c 100644
--- a/docker-api/src/main/java/com/yahoo/vespa/hosted/dockerapi/ContainerResources.java
+++ b/docker-api/src/main/java/com/yahoo/vespa/hosted/dockerapi/ContainerResources.java
@@ -9,7 +9,7 @@ import java.util.Objects;
public class ContainerResources {
public static final ContainerResources UNLIMITED = ContainerResources.from(0, 0, 0);
- private static final int CPU_PERIOD = 100_000; // 100 µs
+ public static final int CPU_PERIOD_US = 100_000; // 100 ms
/**
* Hard limit on container's CPU usage: Implemented using Completely Fair Scheduler (CFS) by allocating a given
@@ -65,11 +65,12 @@ public class ContainerResources {
// Although docker allows to update cpu quota to 0, this is not a legal value, must be set -1 for unlimited
// See: https://github.com/docker/for-linux/issues/558
public int cpuQuota() {
- return cpus > 0 ? (int) (cpus * CPU_PERIOD) : -1;
+ return cpus > 0 ? (int) (cpus * CPU_PERIOD_US) : -1;
}
+ /** Duration (in µs) of a single period used as the basis for process scheduling */
public int cpuPeriod() {
- return CPU_PERIOD;
+ return CPU_PERIOD_US;
}
public int cpuShares() {
diff --git a/docker-api/src/main/java/com/yahoo/vespa/hosted/dockerapi/ContainerStats.java b/docker-api/src/main/java/com/yahoo/vespa/hosted/dockerapi/ContainerStats.java
index 7fbe47b011c..797dffdef1f 100644
--- a/docker-api/src/main/java/com/yahoo/vespa/hosted/dockerapi/ContainerStats.java
+++ b/docker-api/src/main/java/com/yahoo/vespa/hosted/dockerapi/ContainerStats.java
@@ -111,14 +111,20 @@ public class ContainerStats {
}
public int getOnlineCpus() { return this.onlineCpus; }
+
+ /** Total CPU time (in ns) spent executing all the processes on this host */
public long getSystemCpuUsage() { return this.systemCpuUsage; }
+
+ /** Total CPU time (in ns) spent running all the processes in this container */
public long getTotalUsage() { return totalUsage; }
+
+ /** Total CPU time (in ns) spent in kernel mode while executing processes in this container */
public long getUsageInKernelMode() { return usageInKernelMode; }
- /** Total CPU time processes in this container were throttled for */
+ /** Total CPU time (in ns) processes in this container were throttled for */
public long getThrottledTime() { return throttledTime; }
- /** Number of periods when throttling enabled for this container */
+ /** Number of periods with throttling enabled for this container */
public long getThrottlingActivePeriods() { return throttlingActivePeriods; }
/** Number of periods this container hit the throttling limit */