mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
Merge pull request #51786 from majiayu000/43810-fix-stats-api-docs-cgroups-v2
docs: update stats API description for cgroups v2 compatibility
This commit is contained in:
@@ -6259,7 +6259,11 @@ definitions:
|
|||||||
example: 0
|
example: 0
|
||||||
stats:
|
stats:
|
||||||
description: |
|
description: |
|
||||||
All the stats exported via memory.stat. when using cgroups v2.
|
All the stats exported via memory.stat.
|
||||||
|
|
||||||
|
The fields in this object differ between cgroups v1 and v2.
|
||||||
|
On cgroups v1, fields such as `cache`, `rss`, `mapped_file` are available.
|
||||||
|
On cgroups v2, fields such as `file`, `anon`, `inactive_file` are available.
|
||||||
|
|
||||||
This field is Linux-specific and omitted for Windows containers.
|
This field is Linux-specific and omitted for Windows containers.
|
||||||
type: "object"
|
type: "object"
|
||||||
@@ -8532,7 +8536,8 @@ paths:
|
|||||||
|
|
||||||
To calculate the values shown by the `stats` command of the docker cli tool
|
To calculate the values shown by the `stats` command of the docker cli tool
|
||||||
the following formulas can be used:
|
the following formulas can be used:
|
||||||
* used_memory = `memory_stats.usage - memory_stats.stats.cache`
|
* used_memory = `memory_stats.usage - memory_stats.stats.cache` (cgroups v1)
|
||||||
|
* used_memory = `memory_stats.usage - memory_stats.stats.inactive_file` (cgroups v2)
|
||||||
* available_memory = `memory_stats.limit`
|
* available_memory = `memory_stats.limit`
|
||||||
* Memory usage % = `(used_memory / available_memory) * 100.0`
|
* Memory usage % = `(used_memory / available_memory) * 100.0`
|
||||||
* cpu_delta = `cpu_stats.cpu_usage.total_usage - precpu_stats.cpu_usage.total_usage`
|
* cpu_delta = `cpu_stats.cpu_usage.total_usage - precpu_stats.cpu_usage.total_usage`
|
||||||
|
|||||||
Reference in New Issue
Block a user