CVS commit: [netbsd-8] src/usr.bin/vmstat

2019-07-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jul 22 18:10:32 UTC 2019

Modified Files:
src/usr.bin/vmstat [netbsd-8]: vmstat.c

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1304):

usr.bin/vmstat/vmstat.c: revision 1.226

Use PRWORD for printing -m/-mW totals so fields don't run in to each other.

While here, update field widths for 'vmstat -mW' for modern machines.


To generate a diff of this commit:
cvs rdiff -u -r1.216.6.4 -r1.216.6.5 src/usr.bin/vmstat/vmstat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/vmstat/vmstat.c
diff -u src/usr.bin/vmstat/vmstat.c:1.216.6.4 src/usr.bin/vmstat/vmstat.c:1.216.6.5
--- src/usr.bin/vmstat/vmstat.c:1.216.6.4	Tue Mar  6 11:15:33 2018
+++ src/usr.bin/vmstat/vmstat.c	Mon Jul 22 18:10:32 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: vmstat.c,v 1.216.6.4 2018/03/06 11:15:33 martin Exp $ */
+/* $NetBSD: vmstat.c,v 1.216.6.5 2019/07/22 18:10:32 martin Exp $ */
 
 /*-
  * Copyright (c) 1998, 2000, 2001, 2007 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = "@(#)vmstat.c	8.2 (Berkeley) 3/1/95";
 #else
-__RCSID("$NetBSD: vmstat.c,v 1.216.6.4 2018/03/06 11:15:33 martin Exp $");
+__RCSID("$NetBSD: vmstat.c,v 1.216.6.5 2019/07/22 18:10:32 martin Exp $");
 #endif
 #endif /* not lint */
 
@@ -1414,7 +1414,7 @@ dopool_sysctl(int verbose, int wide)
 	size_t i, len;
 	int name_len, ovflw;
 	struct pool_sysctl *pp, *data;
-	char in_use[8], avail[8], maxp[32];
+	char maxp[32];
 
 	data = asysctlbyname("kern.pool", &len);
 	if (data == NULL)
@@ -1426,23 +1426,23 @@ dopool_sysctl(int verbose, int wide)
 
 	(void)printf("Memory resource pool statistics\n");
 	(void)printf(
-	"%-*s%*s%*s%5s%*s%s%s%*s%*s%6s%s%6s%6s%6s%5s%s%s\n",
+	"%-*s%*s%*s%*s%*s%s%s%*s%*s%*s%s%*s%6s%*s%5s%s%s\n",
 	wide ? 16 : 11, "Name",
-	wide ? 6 : 5, "Size",
+	wide ? 7 : 5, "Size",
 	wide ? 12 : 9, "Requests",
-	"Fail",
+	wide ? 8 : 5, "Fail",
 	wide ? 12 : 9, "Releases",
-	wide ? "  InUse" : "",
-	wide ? " Avail" : "",
-	wide ? 7 : 6, "Pgreq",
-	wide ? 7 : 6, "Pgrel",
-	"Npage",
+	wide ? "InUse" : "",
+	wide ? "Avail" : "",
+	wide ? 11 : 6, "Pgreq",
+	wide ? 11 : 6, "Pgrel",
+	wide ? 8 : 6, "Npage",
 	wide ? " PageSz" : "",
-	"Hiwat",
+	wide ? 7 : 6, "Hiwat",
 	"Minpg",
-	"Maxpg",
+	wide ? 7 : 6, "Maxpg",
 	"Idle",
-	wide ? " Flags" : "",
+	wide ? "  Flags" : "",
 	wide ? "   Util" : "");
 
 	name_len = MIN((int)sizeof(pp->pr_wchan), wide ? 16 : 11);
@@ -1457,35 +1457,33 @@ dopool_sysctl(int verbose, int wide)
 			pp->pr_maxpages);
 		ovflw = 0;
 		PRWORD(ovflw, "%-*s", name_len, 0, pp->pr_wchan);
-		PRWORD(ovflw, " %*" PRIu64, wide ? 6 : 5, 1, pp->pr_size);
+		PRWORD(ovflw, " %*" PRIu64, wide ? 7 : 5, 1, pp->pr_size);
 		PRWORD(ovflw, " %*" PRIu64, wide ? 12 : 9, 1, pp->pr_nget);
 		pool_totals.pt_nget += pp->pr_nget;
-		PRWORD(ovflw, " %*" PRIu64, 5, 1, pp->pr_nfail);
+		PRWORD(ovflw, " %*" PRIu64, wide ? 8 : 5, 1, pp->pr_nfail);
 		pool_totals.pt_nfail += pp->pr_nfail;
 		PRWORD(ovflw, " %*" PRIu64, wide ? 12 : 9, 1, pp->pr_nput);
 		pool_totals.pt_nput += pp->pr_nput;
 		if (wide) {
-			PRWORD(ovflw, " %*" PRIu64, 7, 1, pp->pr_nout);
+			PRWORD(ovflw, " %*" PRIu64, 9, 1, pp->pr_nout);
 			pool_totals.pt_nout += pp->pr_nout;
-		}
-		if (wide) {
-			PRWORD(ovflw, " %*" PRIu64, 6, 1, pp->pr_nitems);
+			PRWORD(ovflw, " %*" PRIu64, 9, 1, pp->pr_nitems);
 			pool_totals.pt_nitems += pp->pr_nitems;
 		}
-		PRWORD(ovflw, " %*" PRIu64, wide ? 7 : 6, 1, pp->pr_npagealloc);
+		PRWORD(ovflw, " %*" PRIu64, wide ? 11 : 6, 1, pp->pr_npagealloc);
 		pool_totals.pt_npagealloc += pp->pr_npagealloc;
-		PRWORD(ovflw, " %*" PRIu64, wide ? 7 : 6, 1, pp->pr_npagefree);
+		PRWORD(ovflw, " %*" PRIu64, wide ? 11 : 6, 1, pp->pr_npagefree);
 		pool_totals.pt_npagefree += pp->pr_npagefree;
-		PRWORD(ovflw, " %*" PRIu64, 6, 1, pp->pr_npages);
+		PRWORD(ovflw, " %*" PRIu64, wide ? 8 : 6, 1, pp->pr_npages);
 		pool_totals.pt_npages += pp->pr_npages;
 		if (wide)
 			PRWORD(ovflw, " %*" PRIu64, 7, 1, pp->pr_pagesize);
-		PRWORD(ovflw, " %*" PRIu64, 6, 1, pp->pr_hiwat);
+		PRWORD(ovflw, " %*" PRIu64, wide ? 7 : 6, 1, pp->pr_hiwat);
 		PRWORD(ovflw, " %*" PRIu64, 6, 1, pp->pr_minpages);
-		PRWORD(ovflw, " %*s", 6, 1, maxp);
+		PRWORD(ovflw, " %*s", wide ? 7 : 6, 1, maxp);
 		PRWORD(ovflw, " %*" PRIu64, 5, 1, pp->pr_nidle);
 		if (wide)
-			PRWORD(ovflw, " 0x%0*" PRIx64, 4, 1,
+			PRWORD(ovflw, " 0x%0*" PRIx64, 5, 1,
 			pp->pr_flags);
 
 		this_inuse = pp->pr_nout * pp->pr_size;
@@ -1510,25 +1508,20 @@ dopool_sysctl(int verbose, int wide)
 		}
 		(void)printf("\n");
 	}
+	ovflw = 0;
+	PRWORD(ovflw, "%-*s", name_len, 0, "Totals");
+	PRWORD(ovflw, " %*s", wide ? 7 : 5, 1, "");
+	PRWORD(ovflw, " %*" 

CVS commit: [netbsd-8] src/usr.bin/vmstat

2019-07-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jul 22 18:10:32 UTC 2019

Modified Files:
src/usr.bin/vmstat [netbsd-8]: vmstat.c

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1304):

usr.bin/vmstat/vmstat.c: revision 1.226

Use PRWORD for printing -m/-mW totals so fields don't run in to each other.

While here, update field widths for 'vmstat -mW' for modern machines.


To generate a diff of this commit:
cvs rdiff -u -r1.216.6.4 -r1.216.6.5 src/usr.bin/vmstat/vmstat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.