// getCgroupFilePath constructs file path to get targetted stats file. func getCgroupFilePath(containerId, base, target, file string) string { if len(base) == 0 { base = common.HostSys(fmt.Sprintf("fs/cgroup/%s/docker", target)) } statfile := path.Join(base, containerId, file) if _, err := os.Stat(statfile); os.IsNotExist(err) { statfile = path.Join( common.HostSys(fmt.Sprintf("fs/cgroup/%s/system.slice", target)), "docker-"+containerId+".scope", file) } return statfile }
func sysCpuPath(cpu int32, relPath string) string { return common.HostSys(fmt.Sprintf("devices/system/cpu/cpu%d", cpu), relPath) }
func CgroupCPUDocker(containerid string) (*cpu.CPUTimesStat, error) { return CgroupCPU(containerid, common.HostSys("fs/cgroup/cpuacct/docker")) }
func CgroupMemDocker(containerId string) (*CgroupMemStat, error) { return CgroupMem(containerId, common.HostSys("fs/cgroup/memory/docker")) }