var procSMapsHeaderLine … type ProcSMapsRollup … // ProcSMapsRollup reads from /proc/[pid]/smaps_rollup to get summed memory information of the // process. // // If smaps_rollup does not exists (require kernel >= 4.15), the content of /proc/pid/smaps will // we read and summed. func (p Proc) ProcSMapsRollup() (ProcSMapsRollup, error) { … } // Read /proc/pid/smaps and do the roll-up in Go code. func (p Proc) procSMapsRollupManual() (ProcSMapsRollup, error) { … } func (s *ProcSMapsRollup) parseLine(line string) error { … } func (s *ProcSMapsRollup) addValue(k string, vUintBytes uint64) { … }