()
| 23 | ) |
| 24 | |
| 25 | func 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 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…