MCPcopy Create free account
hub / github.com/containerd/nerdctl / calculateMemPercent

Function calculateMemPercent

pkg/statsutil/stats_linux.go:32–39  ·  view source on GitHub ↗
(limit float64, usedNo float64)

Source from the content-addressed store, hash-verified

30)
31
32func calculateMemPercent(limit float64, usedNo float64) float64 {
33 // Limit will never be 0 unless the container is not running and we haven't
34 // got any data from cgroup
35 if limit != 0 {
36 return usedNo / limit * 100.0
37 }
38 return 0
39}
40
41func SetCgroupStatsFields(previousStats *ContainerStats, data *v1.Metrics, links []netlink.Link, systemInfo SystemInfo) (StatsEntry, error) {
42 cpuPercent := calculateCgroupCPUPercent(previousStats, data, systemInfo)

Callers 2

SetCgroupStatsFieldsFunction · 0.85
SetCgroup2StatsFieldsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…