(cgroupPath string)
| 636 | } |
| 637 | |
| 638 | func readCPUStats(cgroupPath string) (*stats.CPUStat, error) { |
| 639 | cpuStat := make(map[string]uint64) |
| 640 | if err := readKVStatsFile(cgroupPath, "cpu.stat", cpuStat); err != nil { |
| 641 | if os.IsNotExist(err) { |
| 642 | return &stats.CPUStat{}, nil |
| 643 | } |
| 644 | return nil, err |
| 645 | } |
| 646 | return &stats.CPUStat{ |
| 647 | UsageUsec: cpuStat["usage_usec"], |
| 648 | UserUsec: cpuStat["user_usec"], |
| 649 | SystemUsec: cpuStat["system_usec"], |
| 650 | NrPeriods: cpuStat["nr_periods"], |
| 651 | NrThrottled: cpuStat["nr_throttled"], |
| 652 | ThrottledUsec: cpuStat["throttled_usec"], |
| 653 | NrBursts: cpuStat["nr_bursts"], |
| 654 | BurstUsec: cpuStat["burst_usec"], |
| 655 | PSI: getStatPSIFromFile(filepath.Join(cgroupPath, "cpu.pressure")), |
| 656 | }, nil |
| 657 | } |
| 658 | |
| 659 | func readMemoryStats(cgroupPath string) (*stats.MemoryStat, error) { |
| 660 | memoryStat := make(map[string]uint64, 40) |
no test coverage detected
searching dependent graphs…