diff --git a/process.go b/process.go index 5a65c240..d403a582 100644 --- a/process.go +++ b/process.go @@ -33,10 +33,10 @@ type RlimitStat struct { } type IOCountersStat struct { - ReadCount int32 `json:"read_count"` - WriteCount int32 `json:"write_count"` - ReadBytes int32 `json:"read_bytes"` - WriteBytes int32 `json:"write_bytes"` + ReadCount uint64 `json:"read_count"` + WriteCount uint64 `json:"write_count"` + ReadBytes uint64 `json:"read_bytes"` + WriteBytes uint64 `json:"write_bytes"` } type NumCtxSwitchesStat struct { diff --git a/process_linux.go b/process_linux.go index 8457d05c..6460ac6c 100644 --- a/process_linux.go +++ b/process_linux.go @@ -346,24 +346,27 @@ func (p *Process) fillFromIO() (*IOCountersStat, error) { ret := &IOCountersStat{} for _, line := range lines { - field := strings.Split(line, ":") + field := strings.Fields(line) if len(field) < 2 { continue } - t, err := strconv.ParseInt(strings.Trim(field[1], " \t"), 10, 32) + t, err := strconv.ParseUint(field[1], 10, 64) if err != nil { return nil, err } - - switch field[0] { - case "rchar": - ret.ReadCount = int32(t) - case "wchar": - ret.WriteCount = int32(t) + param := field[0] + if strings.HasSuffix(param, ":") { + param = param[:len(param)-1] + } + switch param { + case "syscr": + ret.ReadCount = t + case "syscw": + ret.WriteCount = t case "read_bytes": - ret.ReadBytes = int32(t) + ret.ReadBytes = t case "write_bytes": - ret.WriteBytes = int32(t) + ret.WriteBytes = t } }