git: 18870c75bfa7 - stable/13 - systat -vm: Humanize output for ease of reading.

From: Kirk McKusick <mckusick_at_FreeBSD.org>
Date: Tue, 18 Jan 2022 23:11:05 UTC
The branch stable/13 has been updated by mckusick:

URL: https://cgit.FreeBSD.org/src/commit/?id=18870c75bfa748be8cff97ffcfc570af99c1ae35

commit 18870c75bfa748be8cff97ffcfc570af99c1ae35
Author:     Kirk McKusick <mckusick@FreeBSD.org>
AuthorDate: 2022-01-02 03:47:27 +0000
Commit:     Kirk McKusick <mckusick@FreeBSD.org>
CommitDate: 2022-01-18 23:09:19 +0000

    systat -vm: Humanize output for ease of reading.
    
    Using 8 width is too wide for large numbers like 1379991K;
    1330M is easier to read.
    
    Submitted by: ota_j.email.ne.jp
    Sponsored by: Netflix
    Differential Revision: https://reviews.freebsd.org/D33495
    
    (cherry picked from commit a115a4aa51ae891330c9c4404dd4df13b601556f)
---
 usr.bin/systat/vmstat.c | 74 ++++++++++++++++++++++++-------------------------
 1 file changed, 37 insertions(+), 37 deletions(-)

diff --git a/usr.bin/systat/vmstat.c b/usr.bin/systat/vmstat.c
index e84b79bdd184..d269addf145e 100644
--- a/usr.bin/systat/vmstat.c
+++ b/usr.bin/systat/vmstat.c
@@ -181,7 +181,7 @@ closekre(WINDOW *w)
 #define GENSTATROW	 7	/* uses 2 rows and 29 cols */
 #define GENSTATCOL	22
 #define VMSTATROW	 5	/* uses 17 rows and 12-14 cols */
-#define VMSTATCOL	49	/* actually 50-51 for some fields */
+#define VMSTATCOL	52
 #define GRAPHROW	10	/* uses 3 rows and 49-51 cols */
 #define GRAPHCOL	 0
 #define VNSTATROW	13	/* uses 4 rows and 13 columns */
@@ -318,25 +318,25 @@ labelkre(void)
 	mvprintw(INTSROW, INTSCOL + 1, "Interrupts");
 	mvprintw(INTSROW + 1, INTSCOL + 6, "total");
 
-	mvprintw(VMSTATROW, VMSTATCOL + 9, "ioflt");
-	mvprintw(VMSTATROW + 1, VMSTATCOL + 9, "cow");
-	mvprintw(VMSTATROW + 2, VMSTATCOL + 9, "zfod");
-	mvprintw(VMSTATROW + 3, VMSTATCOL + 9, "ozfod");
-	mvprintw(VMSTATROW + 4, VMSTATCOL + 9 - 1, "%%ozfod");
-	mvprintw(VMSTATROW + 5, VMSTATCOL + 9, "daefr");
-	mvprintw(VMSTATROW + 6, VMSTATCOL + 9, "prcfr");
-	mvprintw(VMSTATROW + 7, VMSTATCOL + 9, "totfr");
-	mvprintw(VMSTATROW + 8, VMSTATCOL + 9, "react");
-	mvprintw(VMSTATROW + 9, VMSTATCOL + 9, "pdwak");
-	mvprintw(VMSTATROW + 10, VMSTATCOL + 9, "pdpgs");
-	mvprintw(VMSTATROW + 11, VMSTATCOL + 9, "intrn");
-	mvprintw(VMSTATROW + 12, VMSTATCOL + 9, "wire");
-	mvprintw(VMSTATROW + 13, VMSTATCOL + 9, "act");
-	mvprintw(VMSTATROW + 14, VMSTATCOL + 9, "inact");
-	mvprintw(VMSTATROW + 15, VMSTATCOL + 9, "laund");
-	mvprintw(VMSTATROW + 16, VMSTATCOL + 9, "free");
+	mvprintw(VMSTATROW, VMSTATCOL + 6, "ioflt");
+	mvprintw(VMSTATROW + 1, VMSTATCOL + 6, "cow");
+	mvprintw(VMSTATROW + 2, VMSTATCOL + 6, "zfod");
+	mvprintw(VMSTATROW + 3, VMSTATCOL + 6, "ozfod");
+	mvprintw(VMSTATROW + 4, VMSTATCOL + 6 - 1, "%%ozfod");
+	mvprintw(VMSTATROW + 5, VMSTATCOL + 6, "daefr");
+	mvprintw(VMSTATROW + 6, VMSTATCOL + 6, "prcfr");
+	mvprintw(VMSTATROW + 7, VMSTATCOL + 6, "totfr");
+	mvprintw(VMSTATROW + 8, VMSTATCOL + 6, "react");
+	mvprintw(VMSTATROW + 9, VMSTATCOL + 6, "pdwak");
+	mvprintw(VMSTATROW + 10, VMSTATCOL + 6, "pdpgs");
+	mvprintw(VMSTATROW + 11, VMSTATCOL + 6, "intrn");
+	mvprintw(VMSTATROW + 12, VMSTATCOL + 6, "wire");
+	mvprintw(VMSTATROW + 13, VMSTATCOL + 6, "act");
+	mvprintw(VMSTATROW + 14, VMSTATCOL + 6, "inact");
+	mvprintw(VMSTATROW + 15, VMSTATCOL + 6, "laund");
+	mvprintw(VMSTATROW + 16, VMSTATCOL + 6, "free");
 	if (LINES - 1 > VMSTATROW + 17)
-		mvprintw(VMSTATROW + 17, VMSTATCOL + 9, "buf");
+		mvprintw(VMSTATROW + 17, VMSTATCOL + 6, "buf");
 
 	mvprintw(GENSTATROW, GENSTATCOL, " Csw  Trp  Sys  Int  Sof  Flt");
 
@@ -472,26 +472,26 @@ showkre(void)
 	putint(total.t_dw, PROCSROW + 2, PROCSCOL + 8, 3);
 	putint(total.t_sl, PROCSROW + 2, PROCSCOL + 12, 4);
 	putint(total.t_sw, PROCSROW + 2, PROCSCOL + 17, 3);
-	PUTRATE(v_io_faults, VMSTATROW, VMSTATCOL + 2, 8 - 2);
-	PUTRATE(v_cow_faults, VMSTATROW + 1, VMSTATCOL + 2, 8 - 2);
-	PUTRATE(v_zfod, VMSTATROW + 2, VMSTATCOL + 2, 8 - 2);
-	PUTRATE(v_ozfod, VMSTATROW + 3, VMSTATCOL, 8);
+	PUTRATE(v_io_faults, VMSTATROW, VMSTATCOL, 5);
+	PUTRATE(v_cow_faults, VMSTATROW + 1, VMSTATCOL, 5);
+	PUTRATE(v_zfod, VMSTATROW + 2, VMSTATCOL, 5);
+	PUTRATE(v_ozfod, VMSTATROW + 3, VMSTATCOL, 5);
 	putint(s.v_zfod != 0 ? (int)(s.v_ozfod * 100.0 / s.v_zfod) : 0,
-	    VMSTATROW + 4, VMSTATCOL + 1, 8 - 1);
-	PUTRATE(v_dfree, VMSTATROW + 5, VMSTATCOL + 2, 8 - 2);
-	PUTRATE(v_pfree, VMSTATROW + 6, VMSTATCOL + 2, 8 - 2);
-	PUTRATE(v_tfree, VMSTATROW + 7, VMSTATCOL, 8);
-	PUTRATE(v_reactivated, VMSTATROW + 8, VMSTATCOL, 8);
-	PUTRATE(v_pdwakeups, VMSTATROW + 9, VMSTATCOL, 8);
-	PUTRATE(v_pdpages, VMSTATROW + 10, VMSTATCOL, 8);
-	PUTRATE(v_intrans, VMSTATROW + 11, VMSTATCOL, 8);
-	sysputpage(wnd, VMSTATROW + 12, VMSTATCOL + 2, 8 - 2, s.v_wire_count, 0);
-	sysputpage(wnd, VMSTATROW + 13, VMSTATCOL + 2, 8 - 2, s.v_active_count, 0);
-	sysputpage(wnd, VMSTATROW + 14, VMSTATCOL + 2, 8 - 2, s.v_inactive_count, 0);
-	sysputpage(wnd, VMSTATROW + 15, VMSTATCOL + 2, 8 - 2, s.v_laundry_count, 0);
-	sysputpage(wnd, VMSTATROW + 16, VMSTATCOL + 2, 8 - 2, s.v_free_count, 0);
+	    VMSTATROW + 4, VMSTATCOL, 5);
+	PUTRATE(v_dfree, VMSTATROW + 5, VMSTATCOL, 5);
+	PUTRATE(v_pfree, VMSTATROW + 6, VMSTATCOL, 5);
+	PUTRATE(v_tfree, VMSTATROW + 7, VMSTATCOL, 5);
+	PUTRATE(v_reactivated, VMSTATROW + 8, VMSTATCOL, 5);
+	PUTRATE(v_pdwakeups, VMSTATROW + 9, VMSTATCOL, 5);
+	PUTRATE(v_pdpages, VMSTATROW + 10, VMSTATCOL, 5);
+	PUTRATE(v_intrans, VMSTATROW + 11, VMSTATCOL, 5);
+	sysputpage(wnd, VMSTATROW + 12, VMSTATCOL, 5, s.v_wire_count, 0);
+	sysputpage(wnd, VMSTATROW + 13, VMSTATCOL, 5, s.v_active_count, 0);
+	sysputpage(wnd, VMSTATROW + 14, VMSTATCOL, 5, s.v_inactive_count, 0);
+	sysputpage(wnd, VMSTATROW + 15, VMSTATCOL, 5, s.v_laundry_count, 0);
+	sysputpage(wnd, VMSTATROW + 16, VMSTATCOL, 5, s.v_free_count, 0);
 	if (LINES - 1 > VMSTATROW + 17)
-		sysputuint64(wnd, VMSTATROW + 17, VMSTATCOL + 2, 8 - 2, s.bufspace, 0);
+		sysputuint64(wnd, VMSTATROW + 17, VMSTATCOL, 5, s.bufspace, 0);
 	PUTRATE(v_vnodein, PAGEROW + 2, PAGECOL + 6, 5);
 	PUTRATE(v_vnodeout, PAGEROW + 2, PAGECOL + 12, 5);
 	PUTRATE(v_swapin, PAGEROW + 2, PAGECOL + 19, 5);