From ec5a8b2a5081dc3497a67cdcda34a571b3995db0 Mon Sep 17 00:00:00 2001 From: chi-chi weng <949409306@qq.com> Date: Fri, 4 Jan 2019 17:31:43 +0800 Subject: [PATCH] Add VmHWM VmHWM: Peak resident set size ("high water mark"). http://man7.org/linux/man-pages/man5/proc.5.html --- process/process_linux.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/process/process_linux.go b/process/process_linux.go index ecdd7b4..9e77500 100644 --- a/process/process_linux.go +++ b/process/process_linux.go @@ -33,6 +33,7 @@ const ( type MemoryInfoExStat struct { RSS uint64 `json:"rss"` // bytes VMS uint64 `json:"vms"` // bytes + HWM uint64 `json:"hwm"` . // bytes Shared uint64 `json:"shared"` // bytes Text uint64 `json:"text"` // bytes Lib uint64 `json:"lib"` // bytes @@ -1083,6 +1084,13 @@ func (p *Process) fillFromStatusWithContext(ctx context.Context) error { return err } p.memInfo.Swap = v * 1024 + case "VmHWM": + value := strings.Trim(value, " kB") // remove last "kB" + v, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return err + } + p.memInfo.HWM = v * 1024 case "VmData": value := strings.Trim(value, " kB") // remove last "kB" v, err := strconv.ParseUint(value, 10, 64)