top: follow ps lead & add several IO accounting fields

Some time ago, IO accounting was added for the library
and exploited by the ps program. This patch just plays
a little catch-up & adds similar functionality to top.

[ and we also finally get around to incrementing the ]
[ rcfile id which should have already been done when ]
[ the smaps fields were added or, at least, with USS ]

Reference(s):
. added IO accounting to ps program
commit 8baf8eeab4
. added IO accounting to library
commit a7afe06e6f

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner 2021-06-20 00:00:00 -05:00 committed by Craig Small
parent e7acf3caf0
commit ae8d63addb
3 changed files with 24 additions and 3 deletions

View File

@ -1677,8 +1677,12 @@ static struct {
{ 6, SK_Kb, A_right, PIDS_SMAP_PSS_ANON }, // ul_int EU_PZA
{ 6, SK_Kb, A_right, PIDS_SMAP_PSS_FILE }, // ul_int EU_PZF
{ 6, SK_Kb, A_right, PIDS_SMAP_PSS_SHMEM }, // ul_int EU_PZS
{ 6, SK_Kb, A_right, PIDS_SMAP_PRV_TOTAL } // ul_int EU_USS
#define eu_LAST EU_USS
{ 6, SK_Kb, A_right, PIDS_SMAP_PRV_TOTAL }, // ul_int EU_USS
{ 6, -1, A_right, PIDS_IO_READ_BYTES }, // ul_int EU_IRB
{ 5, -1, A_right, PIDS_IO_READ_OPS }, // ul_int EU_IRO
{ 6, -1, A_right, PIDS_IO_WRITE_BYTES }, // ul_int EU_IWB
{ 5, -1, A_right, PIDS_IO_WRITE_OPS } // ul_int EU_IWO
#define eu_LAST EU_IWO
// xtra Fieldstab 'pseudo pflag' entries for the newlib interface . . . . . . .
#define eu_CMDLINE eu_LAST +1
#define eu_TICS_ALL_C eu_LAST +2
@ -5908,6 +5912,10 @@ static const char *task_show (const WIN_t *q, struct pids_stack *p) {
/* ul_int, scale_num */
case EU_FL1: // PIDS_FLT_MAJ
case EU_FL2: // PIDS_FLT_MIN
case EU_IRB: // PIDS_IO_READ_BYTES
case EU_IRO: // PIDS_IO_READ_OPS
case EU_IWB: // PIDS_IO_WRITE_BYTES
case EU_IWO: // PIDS_IO_WRITE_OPS
cp = scale_num(rSv(i, ul_int), W, Jn);
break;
/* ul_int, scale_pcnt */

View File

@ -190,6 +190,7 @@ enum pflag {
EU_LID,
EU_EXE,
EU_RSS, EU_PSS, EU_PZA, EU_PZF, EU_PZS, EU_USS,
EU_IRB, EU_IRO, EU_IWB, EU_IWO,
#ifdef USE_X_COLHDR
// not really pflags, used with tbl indexing
EU_MAXPFLGS
@ -485,7 +486,7 @@ typedef struct WIN_t {
#define RCF_EYECATCHER "Config File (Linux processes with windows)\n"
#define RCF_PLUS_H "\\]^_`abcdefghij"
#define RCF_PLUS_J "klmnopqrstuvwxyz"
#define RCF_VERSION_ID 'j'
#define RCF_VERSION_ID 'k'
/* The default fields displayed and their order, if nothing is
specified by the loser, oops user.

View File

@ -332,6 +332,18 @@ static void build_two_nlstabs (void) {
/* Translation Hint: maximum 'USS' = 6 */
Head_nlstab[EU_USS] = _("USS");
Desc_nlstab[EU_USS] = _("Unique RSS, KiB");
/* Translation Hint: maximum 'ioR' = 6 */
Head_nlstab[EU_IRB] = _("ioR");
Desc_nlstab[EU_IRB] = _("I/O Bytes Read");
/* Translation Hint: maximum 'ioRop' = 5 */
Head_nlstab[EU_IRO] = _("ioRop");
Desc_nlstab[EU_IRO] = _("I/O Read Operations");
/* Translation Hint: maximum 'ioW' = 6 */
Head_nlstab[EU_IWB] = _("ioW");
Desc_nlstab[EU_IWB] = _("I/O Bytes Written");
/* Translation Hint: maximum 'ioWop' = 5 */
Head_nlstab[EU_IWO] = _("ioWop");
Desc_nlstab[EU_IWO] = _("I/O Write Operations");
}