Documentation ¶
Overview ¶
Package docker contains few helper functions copied from https://github.com/docker/cli/blob/master/cli/command/container/stats_helpers.go
Index ¶
- func CalculateCPUPercentUnix(previousCPU, previousSystem uint64, v *container.StatsResponse) float64
- func CalculateCPUPercentWindows(v *container.StatsResponse) float64
- func CalculateMemPercentUnixNoCache(limit, usedNoCache float64) float64
- func CalculateMemUsageUnixNoCache(mem container.MemoryStats) float64
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalculateCPUPercentUnix ¶
func CalculateCPUPercentUnix(previousCPU, previousSystem uint64, v *container.StatsResponse) float64
CalculateCPUPercentUnix calculate CPU usage (for Unix, in percentages)
func CalculateCPUPercentWindows ¶
func CalculateCPUPercentWindows(v *container.StatsResponse) float64
CalculateCPUPercentWindows calculate CPU usage (for Windows, in percentages)
func CalculateMemPercentUnixNoCache ¶
CalculateMemPercentUnixNoCache calculate memory usage of the container, in percentages.
func CalculateMemUsageUnixNoCache ¶
func CalculateMemUsageUnixNoCache(mem container.MemoryStats) float64
CalculateMemUsageUnixNoCache calculate memory usage of the container. Cache is intentionally excluded to avoid misinterpretation of the output.
On Docker 19.03 and older, the result is `mem.Usage - mem.Stats["cache"]`. On new docker with cgroup v1 host, the result is `mem.Usage - mem.Stats["total_inactive_file"]`. On new docker with cgroup v2 host, the result is `mem.Usage - mem.Stats["inactive_file"]`.
This definition is designed to be consistent with past values and the latest docker CLI * https://github.com/docker/cli/blob/6e2838e18645e06f3e4b6c5143898ccc44063e3b/cli/command/container/stats_helpers.go#L239
Types ¶
This section is empty.