Skip to content

Commit 7912b20

Browse files
committed
Skip parsing unused fields in proc_smaps
Signed-off-by: Pierre Fersing <[email protected]>
1 parent f8b2801 commit 7912b20

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

proc_smaps.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,13 +121,15 @@ func (s *ProcSMapsRollup) parseLine(line string) error {
121121
}
122122

123123
k := kv[0]
124+
if k == "VmFlags" {
125+
return nil
126+
}
127+
124128
v := strings.TrimSpace(kv[1])
125129
v = strings.TrimRight(v, " kB")
126130

127131
vKBytes, err := strconv.ParseUint(v, 10, 64)
128-
129-
// VmFlags is the only field which is not a number, ignore parse error for it.
130-
if err != nil && k != "VmFlags" {
132+
if err != nil {
131133
return err
132134
}
133135
vBytes := vKBytes * 1024

0 commit comments

Comments
 (0)