From 9e3563f8ca87123bfb7d5f4189b4a37cedecb270 Mon Sep 17 00:00:00 2001 From: Nikolay Sivko Date: Sat, 13 Sep 2014 00:29:54 +0400 Subject: [PATCH 1/2] change NumCtxSwitchesStat fields to int64 --- process.go | 4 ++-- process_linux.go | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/process.go b/process.go index 47abc17..8ad2071 100644 --- a/process.go +++ b/process.go @@ -38,8 +38,8 @@ type IOCountersStat struct { } type NumCtxSwitchesStat struct { - Voluntary int32 `json:"voluntary"` - Involuntary int32 `json:"involuntary"` + Voluntary int64 `json:"voluntary"` + Involuntary int64 `json:"involuntary"` } func (p Process) String() string { diff --git a/process_linux.go b/process_linux.go index be8041e..8e60793 100644 --- a/process_linux.go +++ b/process_linux.go @@ -430,17 +430,17 @@ func (p *Process) fillFromStatus() error { } p.numThreads = int32(v) case "voluntary_ctxt_switches": - v, err := strconv.ParseInt(value, 10, 32) + v, err := strconv.ParseInt(value, 10, 64) if err != nil { return err } - p.numCtxSwitches.Voluntary = int32(v) + p.numCtxSwitches.Voluntary = v case "nonvoluntary_ctxt_switches": - v, err := strconv.ParseInt(value, 10, 32) + v, err := strconv.ParseInt(value, 10, 64) if err != nil { return err } - p.numCtxSwitches.Involuntary = int32(v) + p.numCtxSwitches.Involuntary = v } } return nil From e8c96ea07d1783e59db9eb9a662a7a4ed39ac322 Mon Sep 17 00:00:00 2001 From: Nikolay Sivko Date: Tue, 16 Sep 2014 14:08:52 +0400 Subject: [PATCH 2/2] fix DiskIOCountersStat.iotime on linux --- disk_linux.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/disk_linux.go b/disk_linux.go index ee67f1e..1e33c5f 100644 --- a/disk_linux.go +++ b/disk_linux.go @@ -54,7 +54,7 @@ func DiskIOCounters() (map[string]DiskIOCountersStat, error) { writes := mustParseUint64(fields[7]) wbytes := mustParseUint64(fields[9]) wtime := mustParseUint64(fields[10]) - iotime := mustParseUint64(fields[13]) + iotime := mustParseUint64(fields[12]) d := DiskIOCountersStat{ ReadBytes: rbytes * SectorSize, WriteBytes: wbytes * SectorSize,