mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
docs: add example calculations to container stats API
Signed-off-by: Velko Ivanov <vivanov@deeperplane.com>
This commit is contained in:
parent
22153d111e
commit
441211986c
1 changed files with 10 additions and 0 deletions
|
@ -5994,6 +5994,16 @@ paths:
|
||||||
* `cpu_stats`: `cpu_usage.percpu_usage`
|
* `cpu_stats`: `cpu_usage.percpu_usage`
|
||||||
* `memory_stats`: `max_usage` and `failcnt`
|
* `memory_stats`: `max_usage` and `failcnt`
|
||||||
Also, `memory_stats.stats` fields are incompatible with cgroup v1.
|
Also, `memory_stats.stats` fields are incompatible with cgroup v1.
|
||||||
|
|
||||||
|
To calculate the values shown by the `stats` command of the docker cli tool
|
||||||
|
the following formulas can be used:
|
||||||
|
* used_memory = `memory_stats.usage - memory_stats.stats.cache`
|
||||||
|
* available_memory = `memory_stats.limit`
|
||||||
|
* Memory usage % = `(used_memory / available_memory) * 100.0`
|
||||||
|
* cpu_delta = `cpu_stats.cpu_usage.total_usage - precpu_stats.cpu_usage.total_usage`
|
||||||
|
* system_cpu_delta = `cpu_stats.system_cpu_usage - precpu_stats.system_cpu_usage`
|
||||||
|
* number_cpus = `lenght(cpu_stats.cpu_usage.percpu_usage)` or `cpu_stats.online_cpus`
|
||||||
|
* CPU usage % = `(cpu_delta / system_cpu_delta) * number_cpus * 100.0`
|
||||||
operationId: "ContainerStats"
|
operationId: "ContainerStats"
|
||||||
produces: ["application/json"]
|
produces: ["application/json"]
|
||||||
responses:
|
responses:
|
||||||
|
|
Loading…
Reference in a new issue