Signed-off-by: Velko Ivanov <vivanov@deeperplane.com>
(cherry picked from commit 441211986c847ef08ec1d40432e2ec86a7ae1741)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
| ... | ... |
@@ -5861,6 +5861,16 @@ paths: |
| 5861 | 5861 |
If either `precpu_stats.online_cpus` or `cpu_stats.online_cpus` is |
| 5862 | 5862 |
nil then for compatibility with older daemons the length of the |
| 5863 | 5863 |
corresponding `cpu_usage.percpu_usage` array should be used. |
| 5864 |
+ |
|
| 5865 |
+ To calculate the values shown by the `stats` command of the docker cli tool |
|
| 5866 |
+ the following formulas can be used: |
|
| 5867 |
+ * used_memory = `memory_stats.usage - memory_stats.stats.cache` |
|
| 5868 |
+ * available_memory = `memory_stats.limit` |
|
| 5869 |
+ * Memory usage % = `(used_memory / available_memory) * 100.0` |
|
| 5870 |
+ * cpu_delta = `cpu_stats.cpu_usage.total_usage - precpu_stats.cpu_usage.total_usage` |
|
| 5871 |
+ * system_cpu_delta = `cpu_stats.system_cpu_usage - precpu_stats.system_cpu_usage` |
|
| 5872 |
+ * number_cpus = `lenght(cpu_stats.cpu_usage.percpu_usage)` or `cpu_stats.online_cpus` |
|
| 5873 |
+ * CPU usage % = `(cpu_delta / system_cpu_delta) * number_cpus * 100.0` |
|
| 5864 | 5874 |
operationId: "ContainerStats" |
| 5865 | 5875 |
produces: ["application/json"] |
| 5866 | 5876 |
responses: |