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
This commit is contained in:
@ -78,6 +78,13 @@ enum pids_item {
|
||||
PIDS_ID_TGID, // s_int status: Tgid
|
||||
PIDS_ID_TID, // s_int from /proc/<pid>/task/<tid>
|
||||
PIDS_ID_TPGID, // s_int stat: tty_pgrp
|
||||
PIDS_IO_READ_BYTES, // ul_int io: bytes read
|
||||
PIDS_IO_READ_CHARS, // ul_int io: characters read
|
||||
PIDS_IO_READ_OPS, // ul_int io: read operations
|
||||
PIDS_IO_WRITE_BYTES, // ul_int io: bytes written
|
||||
PIDS_IO_WRITE_CBYTES, // ul_int io: cancelled write bytes
|
||||
PIDS_IO_WRITE_CHARS, // ul_int io: characters written
|
||||
PIDS_IO_WRITE_OPS, // ul_int io: write operations
|
||||
PIDS_LXCNAME, // str derived from CGROUP 'lxc.payload'
|
||||
PIDS_MEM_CODE, // ul_int derived from MEM_CODE_PGS, as KiB
|
||||
PIDS_MEM_CODE_PGS, // ul_int statm: trs
|
||||
|
Reference in New Issue
Block a user