parseCgroupSummary reads each line of the /proc/cgroup file.
(data []byte)
| 69 | |
| 70 | // parseCgroupSummary reads each line of the /proc/cgroup file. |
| 71 | func parseCgroupSummary(data []byte) ([]CgroupSummary, error) { |
| 72 | var CgroupSummarys []CgroupSummary |
| 73 | scanner := bufio.NewScanner(bytes.NewReader(data)) |
| 74 | for scanner.Scan() { |
| 75 | CgroupSummaryString := scanner.Text() |
| 76 | // ignore comment lines |
| 77 | if strings.HasPrefix(CgroupSummaryString, "#") { |
| 78 | continue |
| 79 | } |
| 80 | CgroupSummary, err := parseCgroupSummaryString(CgroupSummaryString) |
| 81 | if err != nil { |
| 82 | return nil, err |
| 83 | } |
| 84 | CgroupSummarys = append(CgroupSummarys, *CgroupSummary) |
| 85 | } |
| 86 | |
| 87 | err := scanner.Err() |
| 88 | return CgroupSummarys, err |
| 89 | } |
| 90 | |
| 91 | // CgroupSummarys returns information about current /proc/cgroups. |
| 92 | func (fs FS) CgroupSummarys() ([]CgroupSummary, error) { |
no test coverage detected
searching dependent graphs…