]> granicus.if.org Git - procps-ng/commitdiff
top: follow ps lead & add several IO accounting fields
authorJim Warner <james.warner@comcast.net>
Sun, 20 Jun 2021 05:00:00 +0000 (00:00 -0500)
committerCraig Small <csmall@dropbear.xyz>
Wed, 23 Jun 2021 08:23:49 +0000 (18:23 +1000)
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 8baf8eeab4d5cf4ce712f3a0048985fe045c87f7
. added IO accounting to library
commit a7afe06e6f1b397b7404fbee724a51f88cc8a59c

Signed-off-by: Jim Warner <james.warner@comcast.net>
top/top.c
top/top.h
top/top_nls.c

index 6fc79400e729d126e5afed696b14f41b01962398..69b218b79a46089a6270fcba35b455b64d7fc633 100644 (file)
--- a/top/top.c
+++ b/top/top.c
@@ -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 */
index f72aff1f7a1cb831bdeeb7a3a657b42c22ff3648..5ab5759bfec8653801279f618183a16f7d52de34 100644 (file)
--- a/top/top.h
+++ b/top/top.h
@@ -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.
index e087a61860b31e16083f70b8100493709d5c97b0..407665ec4fba8863c0f71000eeaa4a9a79fa8f70 100644 (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");
 }