From 5cfe482ffc3dd8f99f9ea79ed50fef14e6fa8ad1 Mon Sep 17 00:00:00 2001 From: roccowong95 Date: Tue, 23 Apr 2019 19:13:54 +0800 Subject: [PATCH] [process io][linux] add ReadChars and WriteChars to IOCounterStat, collected from /proc/${pid}/io rchar and wchar --- process/process.go | 2 ++ process/process_linux.go | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/process/process.go b/process/process.go index a9d10e0..0140aa2 100644 --- a/process/process.go +++ b/process/process.go @@ -70,6 +70,8 @@ type IOCountersStat struct { WriteCount uint64 `json:"writeCount"` ReadBytes uint64 `json:"readBytes"` WriteBytes uint64 `json:"writeBytes"` + ReadChars uint64 `json:"readChars"` + WriteChars uint64 `json:"writeChars"` } type NumCtxSwitchesStat struct { diff --git a/process/process_linux.go b/process/process_linux.go index 8ae99ff..d58c56f 100644 --- a/process/process_linux.go +++ b/process/process_linux.go @@ -950,6 +950,10 @@ func (p *Process) fillFromIOWithContext(ctx context.Context) (*IOCountersStat, e ret.ReadBytes = t case "write_bytes": ret.WriteBytes = t + case "rchar": + ret.ReadChars = t + case "wchar": + ret.WriteChars = t } }