Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion fs/cpuacct.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,10 @@ func getPercpuUsageInModes(path string) ([]uint64, []uint64, error) {

for scanner.Scan() {
// Each line is: cpu user system
fields := strings.SplitN(scanner.Text(), " ", 3)
// Keep 'n' at 4 — downstream changes or refactoring of
// "cpuacct.usage_all" could otherwise break system usage parsing.
// (issue: https://github.com/opencontainers/cgroups/issues/46)
fields := strings.SplitN(scanner.Text(), " ", 4)
if len(fields) != 3 {
continue
}
Expand Down
1 change: 1 addition & 0 deletions fs/cpuacct_test.go
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the test data should correspond to the actual data observed in the reporter's distro

Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const (
5 872544369885276 638763309884944
6 870104915696359 640081778921247
7 870202363887496 638716766259495
8 867579076304580 988021047245223 792312716071280 109505081909990
`
)

Expand Down
Loading