]> granicus.if.org Git - procps-ng/commit
library: adding IO accounting
authorCraig Small <csmall@dropbear.xyz>
Sat, 24 Apr 2021 12:38:48 +0000 (22:38 +1000)
committerCraig Small <csmall@dropbear.xyz>
Sat, 24 Apr 2021 12:38:48 +0000 (22:38 +1000)
commita7afe06e6f1b397b7404fbee724a51f88cc8a59c
tree66a16638562af0b5eb778cde22ff4082b8163673
parentfa31656f0774859d48ac0b37a9336e66db4edf2d
library: adding IO accounting

This is a modification of MR !122 by @renit1609 to fit the new
library.

Problem statement:
The procps library has no PROC_FILLIO flag to
fetch the proc field "/proc/[pid]/io" data
process-wise.
IO Accounting is not included as part of procps.

Requirement:
We have a requirement to fetch process wise
IO utilization which can be used for monitoring.

When looking through the procps library, I see
that IO Accounting (/proc/[pid]/io) is not being
included as part of procps. There is no such
flag like PROC_FILLIO being included in readproc.h .

Solution:
While looking at the implementation done for
other proc fields, I used the spare bits in app code.
I renamed PROC_SPARE_1 as PROC_FILLIO, the spare bit from
PROC_SPARE_* and used it for fetching /proc/[pid]/io
data as part of the procps library similar to other
fields. I moved the PROC_SPARE_* bits each by 1 bit
to retain the spare bits. Meanwhile added the IO fields
in proc_t structure.

References:
 procps-ng/procps!122
 procps-ng/procps#184
proc/pids.c
proc/pids.h
proc/readproc.c
proc/readproc.h