Skip to content

Commit

Permalink
Clarify what io/bio mean and document where to get more info
Browse files Browse the repository at this point in the history
  • Loading branch information
scottchiefbaker committed Jan 30, 2025
1 parent 3cb7b50 commit 5068abe
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 5 additions & 2 deletions plugins/dool_top_bio.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,12 @@ def extract(self):
except IndexError:
continue

read_usage = (self.pidset2[pid]['read_bytes:'] - self.pidset1[pid]['read_bytes:']) * 1.0 / elapsed
# INFO: https://www.kernel.org/doc/html/latest/filesystems/proc.html#proc-pid-io-display-the-io-accounting-fields
#
### 'read_bytes' counts bytes read from the storage layer, i.e. when the block device driver is used
read_usage = (self.pidset2[pid]['read_bytes:'] - self.pidset1[pid]['read_bytes:']) * 1.0 / elapsed
write_usage = (self.pidset2[pid]['write_bytes:'] - self.pidset1[pid]['write_bytes:']) * 1.0 / elapsed
usage = read_usage + write_usage
usage = read_usage + write_usage

### Get the process that spends the most jiffies
if usage > self.val['usage']:
Expand Down
7 changes: 5 additions & 2 deletions plugins/dool_top_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,11 @@ def extract(self):
else:
factor = 1

read_usage = (self.pidset2[pid]['read_bytes:'] - self.pidset1[pid]['read_bytes:']) * factor / elapsed
write_usage = (self.pidset2[pid]['write_bytes:'] - self.pidset1[pid]['write_bytes:']) * factor / elapsed
# INFO: https://www.kernel.org/doc/html/latest/filesystems/proc.html#proc-pid-io-display-the-io-accounting-fields
#
### 'rchar' counts bytes read from the task POV, e.g. open files which may be read from page cache, reading from a socket or pipe
read_usage = (self.pidset2[pid]['rchar:'] - self.pidset1[pid]['rchar:']) * factor / elapsed
write_usage = (self.pidset2[pid]['wchar:'] - self.pidset1[pid]['wchar:']) * factor / elapsed
usage = read_usage + write_usage

### Get the process that spends the most jiffies
Expand Down

0 comments on commit 5068abe

Please sign in to comment.