ps: Add IO Accounting fields

Add the fields for the IO accounting to ps as the library now
has them added from previous commit.

References:
 commit a7afe06e6f
This commit is contained in:
Craig Small 2021-04-24 23:13:38 +10:00
parent a7afe06e6f
commit 8baf8eeab4
4 changed files with 83 additions and 0 deletions

View File

@ -107,6 +107,13 @@ makEXT(ID_SUID)
makEXT(ID_SUSER) makEXT(ID_SUSER)
makEXT(ID_TGID) makEXT(ID_TGID)
makEXT(ID_TPGID) makEXT(ID_TPGID)
makEXT(IO_READ_BYTES)
makEXT(IO_READ_CHARS)
makEXT(IO_READ_OPS)
makEXT(IO_WRITE_BYTES)
makEXT(IO_WRITE_CBYTES)
makEXT(IO_WRITE_CHARS)
makEXT(IO_WRITE_OPS)
makEXT(LXCNAME) makEXT(LXCNAME)
makEXT(NICE) makEXT(NICE)
makEXT(NLWP) makEXT(NLWP)

View File

@ -94,6 +94,13 @@ makREL(ID_SUID)
makREL(ID_SUSER) makREL(ID_SUSER)
makREL(ID_TGID) makREL(ID_TGID)
makREL(ID_TPGID) makREL(ID_TPGID)
makREL(IO_READ_BYTES)
makREL(IO_READ_CHARS)
makREL(IO_READ_OPS)
makREL(IO_WRITE_BYTES)
makREL(IO_WRITE_CBYTES)
makREL(IO_WRITE_CHARS)
makREL(IO_WRITE_OPS)
makREL(LXCNAME) makREL(LXCNAME)
makREL(NICE) makREL(NICE)
makREL(NLWP) makREL(NLWP)

View File

@ -1232,6 +1232,38 @@ setREL2(ID_SGROUP,ID_SGID)
////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////
// IO stats
static int pr_rbytes(char *restrict const outbuf, const proc_t *restrict const pp){
setREL1(IO_READ_BYTES)
return snprintf(outbuf, COLWID, "%lu", rSv(IO_READ_BYTES, ul_int, pp));
}
static int pr_rchars(char *restrict const outbuf, const proc_t *restrict const pp){
setREL1(IO_READ_CHARS)
return snprintf(outbuf, COLWID, "%lu", rSv(IO_READ_CHARS, ul_int, pp));
}
static int pr_rops(char *restrict const outbuf, const proc_t *restrict const pp){
setREL1(IO_READ_OPS)
return snprintf(outbuf, COLWID, "%lu", rSv(IO_READ_OPS, ul_int, pp));
}
static int pr_wbytes(char *restrict const outbuf, const proc_t *restrict const pp){
setREL1(IO_WRITE_BYTES)
return snprintf(outbuf, COLWID, "%lu", rSv(IO_WRITE_BYTES, ul_int, pp));
}
static int pr_wcbytes(char *restrict const outbuf, const proc_t *restrict const pp){
setREL1(IO_WRITE_CBYTES)
return snprintf(outbuf, COLWID, "%lu", rSv(IO_WRITE_CBYTES, ul_int, pp));
}
static int pr_wchars(char *restrict const outbuf, const proc_t *restrict const pp){
setREL1(IO_WRITE_CHARS)
return snprintf(outbuf, COLWID, "%lu", rSv(IO_WRITE_CHARS, ul_int, pp));
}
static int pr_wops(char *restrict const outbuf, const proc_t *restrict const pp){
setREL1(IO_WRITE_OPS)
return snprintf(outbuf, COLWID, "%lu", rSv(IO_WRITE_OPS, ul_int, pp));
}
//////////////////////////////////////////////////////////////////////////////////
// PID pid, TGID tgid // PID pid, TGID tgid
static int pr_procs(char *restrict const outbuf, const proc_t *restrict const pp){ static int pr_procs(char *restrict const outbuf, const proc_t *restrict const pp){
setREL1(ID_TGID) setREL1(ID_TGID)
@ -1676,11 +1708,14 @@ static const format_struct format_array[] = { /*
{"pset", "PSET", pr_nop, PIDS_noop, 4, DEC, TO|RIGHT}, {"pset", "PSET", pr_nop, PIDS_noop, 4, DEC, TO|RIGHT},
{"psr", "PSR", pr_psr, PIDS_PROCESSOR, 3, DEC, TO|RIGHT}, {"psr", "PSR", pr_psr, PIDS_PROCESSOR, 3, DEC, TO|RIGHT},
{"psxpri", "PPR", pr_nop, PIDS_noop, 3, DEC, TO|RIGHT}, {"psxpri", "PPR", pr_nop, PIDS_noop, 3, DEC, TO|RIGHT},
{"rbytes", "RBYTES", pr_rbytes, PIDS_IO_READ_BYTES, 5, LNX, TO|RIGHT},
{"rchars", "RCHARS", pr_rchars, PIDS_IO_READ_CHARS, 5, LNX, TO|RIGHT},
{"re", "RE", pr_nop, PIDS_noop, 3, BSD, AN|RIGHT}, {"re", "RE", pr_nop, PIDS_noop, 3, BSD, AN|RIGHT},
{"resident", "RES", pr_nop, PIDS_MEM_RES_PGS, 5, LNX, PO|RIGHT}, {"resident", "RES", pr_nop, PIDS_MEM_RES_PGS, 5, LNX, PO|RIGHT},
{"rgid", "RGID", pr_rgid, PIDS_ID_RGID, 5, XXX, ET|RIGHT}, {"rgid", "RGID", pr_rgid, PIDS_ID_RGID, 5, XXX, ET|RIGHT},
{"rgroup", "RGROUP", pr_rgroup, PIDS_ID_RGROUP, 8, U98, ET|USER}, /* was 8 wide */ {"rgroup", "RGROUP", pr_rgroup, PIDS_ID_RGROUP, 8, U98, ET|USER}, /* was 8 wide */
{"rlink", "RLINK", pr_nop, PIDS_noop, 8, BSD, AN|RIGHT}, {"rlink", "RLINK", pr_nop, PIDS_noop, 8, BSD, AN|RIGHT},
{"rops", "ROPS", pr_rops, PIDS_IO_READ_OPS, 5, LNX, TO|RIGHT},
{"rss", "RSS", pr_rss, PIDS_VM_RSS, 5, XXX, PO|RIGHT}, /* was 5 wide */ {"rss", "RSS", pr_rss, PIDS_VM_RSS, 5, XXX, PO|RIGHT}, /* was 5 wide */
{"rssize", "RSS", pr_rss, PIDS_VM_RSS, 5, DEC, PO|RIGHT}, /*rsz*/ {"rssize", "RSS", pr_rss, PIDS_VM_RSS, 5, DEC, PO|RIGHT}, /*rsz*/
{"rsz", "RSZ", pr_rss, PIDS_VM_RSS, 5, BSD, PO|RIGHT}, /*rssize*/ {"rsz", "RSZ", pr_rss, PIDS_VM_RSS, 5, BSD, PO|RIGHT}, /*rssize*/
@ -1778,8 +1813,12 @@ static const format_struct format_array[] = { /*
{"vm_stack", "STACK", pr_nop, PIDS_VM_STACK, 5, LNx, PO|RIGHT}, {"vm_stack", "STACK", pr_nop, PIDS_VM_STACK, 5, LNx, PO|RIGHT},
{"vsize", "VSZ", pr_vsz, PIDS_VSIZE_PGS, 6, DEC, PO|RIGHT}, /*vsz*/ {"vsize", "VSZ", pr_vsz, PIDS_VSIZE_PGS, 6, DEC, PO|RIGHT}, /*vsz*/
{"vsz", "VSZ", pr_vsz, PIDS_VM_SIZE, 6, U98, PO|RIGHT}, /*vsize*/ {"vsz", "VSZ", pr_vsz, PIDS_VM_SIZE, 6, U98, PO|RIGHT}, /*vsize*/
{"wbytes", "WBYTES", pr_wbytes, PIDS_IO_WRITE_BYTES, 5, LNX, TO|RIGHT},
{"wcbytes", "WCBYTES", pr_wcbytes, PIDS_IO_WRITE_CBYTES, 5, LNX, TO|RIGHT},
{"wchan", "WCHAN", pr_wchan, PIDS_WCHAN_NAME, 6, XXX, TO|WCHAN}, /* BSD n forces this to nwchan */ /* was 10 wide */ {"wchan", "WCHAN", pr_wchan, PIDS_WCHAN_NAME, 6, XXX, TO|WCHAN}, /* BSD n forces this to nwchan */ /* was 10 wide */
{"wchars", "WCHARS", pr_wchars, PIDS_IO_WRITE_CHARS, 5, LNX, TO|RIGHT},
{"wname", "WCHAN", pr_wchan, PIDS_WCHAN_NAME, 6, SGI, TO|WCHAN}, /* opposite of nwchan */ {"wname", "WCHAN", pr_wchan, PIDS_WCHAN_NAME, 6, SGI, TO|WCHAN}, /* opposite of nwchan */
{"wops", "WOPS", pr_wops, PIDS_IO_WRITE_OPS, 5, LNX, TO|RIGHT},
{"xstat", "XSTAT", pr_nop, PIDS_noop, 5, BSD, AN|RIGHT}, {"xstat", "XSTAT", pr_nop, PIDS_noop, 5, BSD, AN|RIGHT},
{"zone", "ZONE", pr_context, PIDS_ID_TGID, 31, SUN, ET|LEFT}, // Solaris zone == Linux context? {"zone", "ZONE", pr_context, PIDS_ID_TGID, 31, SUN, ET|LEFT}, // Solaris zone == Linux context?
{"zoneid", "ZONEID", pr_nop, PIDS_noop, 31, SUN, ET|RIGHT}, // Linux only offers context names {"zoneid", "ZONEID", pr_nop, PIDS_noop, 31, SUN, ET|RIGHT}, // Linux only offers context names

30
ps/ps.1
View File

@ -1524,6 +1524,14 @@ psr PSR T{
processor that process last executed on. processor that process last executed on.
T} T}
rbytes RBYTES T{
Number of bytes which this process really did cause to be fetched from the storage layer.
T}
rchars RCHARS T{
Number of bytes which this task has caused to be read from storage.
T}
rgid RGID T{ rgid RGID T{
real group ID. real group ID.
T} T}
@ -1533,6 +1541,11 @@ real group name. This will be the textual group ID, if it can be obtained
and the field width permits, or a decimal representation otherwise. and the field width permits, or a decimal representation otherwise.
T} T}
rops ROPS T{
Number of read I/O operations—that is, system calls such as
.BR read "(2) and " pread (2).
T}
rss RSS T{ rss RSS T{
resident set size, the non\-swapped physical memory that a task has used (in resident set size, the non\-swapped physical memory that a task has used (in
kiloBytes). (alias kiloBytes). (alias
@ -1866,10 +1879,27 @@ mappings are currently excluded; this is subject to change. (alias
.BR vsize ). .BR vsize ).
T} T}
wbytes WBYTES T{
Number of bytes which this process caused to be sent to the storage layer.
T}
wcbytes WCBYTES T{
Number of cancelled write bytes.
T}
wchan WCHAN T{ wchan WCHAN T{
name of the kernel function in which the process is sleeping. name of the kernel function in which the process is sleeping.
T} T}
wchars WCHARS T{
Number of bytes which this task has caused, or shall cause to be written to disk.
T}
wops WOPS T{
Number of write I/O operations—that is, system calls such as
.BR write "(2) and " pwrite (2).
T}
.TE .TE
.\" ####################################################################### .\" #######################################################################
.PP .PP