From 5068abef0a960c173a91e84a45e7fea1b0a802c0 Mon Sep 17 00:00:00 2001 From: Scott Baker Date: Thu, 30 Jan 2025 15:30:06 -0800 Subject: [PATCH] Clarify what io/bio mean and document where to get more info --- plugins/dool_top_bio.py | 7 +++++-- plugins/dool_top_io.py | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/plugins/dool_top_bio.py b/plugins/dool_top_bio.py index 96c08a9..7cbe058 100644 --- a/plugins/dool_top_bio.py +++ b/plugins/dool_top_bio.py @@ -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']: diff --git a/plugins/dool_top_io.py b/plugins/dool_top_io.py index 4e0ad7d..f0b44ce 100644 --- a/plugins/dool_top_io.py +++ b/plugins/dool_top_io.py @@ -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