MCPcopy Create free account
hub / github.com/containerd/cgroups / Stat

Method Stat

cgroup1/cpuacct.go:52–70  ·  view source on GitHub ↗
(path string, stats *v1.Metrics)

Source from the content-addressed store, hash-verified

50}
51
52func (c *cpuacctController) Stat(path string, stats *v1.Metrics) error {
53 user, kernel, err := c.getUsage(path)
54 if err != nil {
55 return err
56 }
57 total, err := readUint(filepath.Join(c.Path(path), "cpuacct.usage"))
58 if err != nil {
59 return err
60 }
61 percpu, err := c.percpuUsage(path)
62 if err != nil {
63 return err
64 }
65 stats.CPU.Usage.Total = total
66 stats.CPU.Usage.User = user
67 stats.CPU.Usage.Kernel = kernel
68 stats.CPU.Usage.PerCPU = percpu
69 return nil
70}
71
72func (c *cpuacctController) percpuUsage(path string) ([]uint64, error) {
73 var usage []uint64

Callers

nothing calls this directly

Calls 4

getUsageMethod · 0.95
PathMethod · 0.95
percpuUsageMethod · 0.95
readUintFunction · 0.85

Tested by

no test coverage detected