MCPcopy
hub / github.com/google/cadvisor / main

Function main

utils/cpuload/netlink/example/example.go:25–42  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

23)
24
25func main() {
26 n, err := netlink.New()
27 if err != nil {
28 log.Printf("Failed to create cpu load util: %s", err)
29 return
30 }
31 defer n.Stop()
32
33 paths := []string{"/sys/fs/cgroup/cpu", "/sys/fs/cgroup/cpu/docker"}
34 names := []string{"/", "/docker"}
35 for i, path := range paths {
36 stats, err := n.GetCpuLoad(names[i], path)
37 if err != nil {
38 log.Printf("Error getting cpu load for %q: %s", path, err)
39 }
40 log.Printf("Task load for %s: %+v", path, stats)
41 }
42}

Callers

nothing calls this directly

Calls 3

NewFunction · 0.92
StopMethod · 0.65
GetCpuLoadMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…