Skip to content

Commit

Permalink
[process]: Introduce DiskReadBytes on process which shows Disk IO only.
Browse files Browse the repository at this point in the history
  • Loading branch information
shirou committed May 28, 2024
1 parent 0e9c0ad commit 6bdbf65
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
12 changes: 10 additions & 2 deletions process/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,18 @@ type RlimitStat struct {
}

type IOCountersStat struct {
ReadCount uint64 `json:"readCount"`
// ReadCount is a number of read I/O operations such as syscalls.
ReadCount uint64 `json:"readCount"`
// WriteCount is a number of read I/O operations such as syscalls.
WriteCount uint64 `json:"writeCount"`
ReadBytes uint64 `json:"readBytes"`
// ReadBytes is a number of all I/O read in bytes. This includes disk I/O on Linux and Windows.
ReadBytes uint64 `json:"readBytes"`
// WriteBytes is a number of all I/O write in bytes. This includes disk I/O on Linux and Windows.
WriteBytes uint64 `json:"writeBytes"`
// DiskReadBytes is a number of disk I/O write in bytes. Currently only Linux has this value.
DiskReadBytes uint64 `json:"diskReadBytes"`
// DiskWriteBytes is a number of disk I/O read in bytes. Currently only Linux has this value.
DiskWriteBytes uint64 `json:"diskWriteBytes"`
}

type NumCtxSwitchesStat struct {
Expand Down
6 changes: 5 additions & 1 deletion process/process_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -727,8 +727,12 @@ func (p *Process) fillFromIOWithContext(ctx context.Context) (*IOCountersStat, e
case "syscw":
ret.WriteCount = t
case "read_bytes":
ret.ReadBytes = t
ret.DiskReadBytes = t
case "write_bytes":
ret.DiskWriteBytes = t
case "rchar":
ret.ReadBytes = t
case "wchar":
ret.WriteBytes = t
}
}
Expand Down

0 comments on commit 6bdbf65

Please sign in to comment.