Skip to content

Commit

Permalink
Skip parsing unused fields in proc_smaps
Browse files Browse the repository at this point in the history
Signed-off-by: Pierre Fersing <[email protected]>
  • Loading branch information
PierreF committed May 4, 2020
1 parent f8b2801 commit 7912b20
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions proc_smaps.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,15 @@ func (s *ProcSMapsRollup) parseLine(line string) error {
}

k := kv[0]
if k == "VmFlags" {
return nil
}

v := strings.TrimSpace(kv[1])
v = strings.TrimRight(v, " kB")

vKBytes, err := strconv.ParseUint(v, 10, 64)

// VmFlags is the only field which is not a number, ignore parse error for it.
if err != nil && k != "VmFlags" {
if err != nil {
return err
}
vBytes := vKBytes * 1024
Expand Down

0 comments on commit 7912b20

Please sign in to comment.