CVS commit: src/usr.bin/vmstat

2023-09-09 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Sep  9 20:13:54 UTC 2023

Modified Files:
src/usr.bin/vmstat: vmstat.c

Log Message:
uidinfo is an SLIST.


To generate a diff of this commit:
cvs rdiff -u -r1.257 -r1.258 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.



CVS commit: src/usr.bin/vmstat

2023-09-09 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Sep  9 20:13:54 UTC 2023

Modified Files:
src/usr.bin/vmstat: vmstat.c

Log Message:
uidinfo is an SLIST.


To generate a diff of this commit:
cvs rdiff -u -r1.257 -r1.258 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.257 src/usr.bin/vmstat/vmstat.c:1.258
--- src/usr.bin/vmstat/vmstat.c:1.257	Tue Aug  1 04:20:14 2023
+++ src/usr.bin/vmstat/vmstat.c	Sat Sep  9 20:13:54 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: vmstat.c,v 1.257 2023/08/01 04:20:14 simonb Exp $ */
+/* $NetBSD: vmstat.c,v 1.258 2023/09/09 20:13:54 ad Exp $ */
 
 /*-
  * Copyright (c) 1998, 2000, 2001, 2007, 2019, 2020
@@ -71,7 +71,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.257 2023/08/01 04:20:14 simonb Exp $");
+__RCSID("$NetBSD: vmstat.c,v 1.258 2023/09/09 20:13:54 ad Exp $");
 #endif
 #endif /* not lint */
 
@@ -99,6 +99,7 @@ __RCSID("$NetBSD: vmstat.c,v 1.257 2023/
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -1885,12 +1886,6 @@ enum hashtype {			/* from  
 	HASH_PSLIST
 };
 
-struct uidinfo {		/* XXX: no kernel header file */
-	LIST_ENTRY(uidinfo) ui_hash;
-	uid_t	ui_uid;
-	long	ui_proccnt;
-};
-
 struct kernel_hash {
 	const char *	description;	/* description */
 	int		hashsize;	/* nlist index for hash size */
@@ -1910,7 +1905,7 @@ struct kernel_hash {
 	}, {
 		"user info (uid -> used processes) hash",
 		X_UIHASH, X_UIHASHTBL,
-		HASH_LIST, offsetof(struct uidinfo, ui_hash),
+		HASH_SLIST, offsetof(struct uidinfo, ui_hash),
 	}, {
 		"vnode cache hash",
 		X_VCACHEHASH, X_VCACHETBL,



CVS commit: src/usr.bin/vmstat

2023-07-31 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Tue Aug  1 04:20:14 UTC 2023

Modified Files:
src/usr.bin/vmstat: vmstat.c

Log Message:
For vmstat -mW, add a total KB consumed column and widen a couple of
other fields.


To generate a diff of this commit:
cvs rdiff -u -r1.256 -r1.257 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.256 src/usr.bin/vmstat/vmstat.c:1.257
--- src/usr.bin/vmstat/vmstat.c:1.256	Sun Oct 23 23:30:31 2022
+++ src/usr.bin/vmstat/vmstat.c	Tue Aug  1 04:20:14 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: vmstat.c,v 1.256 2022/10/23 23:30:31 simonb Exp $ */
+/* $NetBSD: vmstat.c,v 1.257 2023/08/01 04:20:14 simonb Exp $ */
 
 /*-
  * Copyright (c) 1998, 2000, 2001, 2007, 2019, 2020
@@ -71,7 +71,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.256 2022/10/23 23:30:31 simonb Exp $");
+__RCSID("$NetBSD: vmstat.c,v 1.257 2023/08/01 04:20:14 simonb Exp $");
 #endif
 #endif /* not lint */
 
@@ -1466,9 +1466,9 @@ dopool_sysctl(int verbose, int wide)
 
 	(void)printf("Memory resource pool statistics\n");
 	(void)printf(
-	"%-*s%*s%*s%*s%*s%s%s%*s%*s%*s%s%*s%6s%*s%*s%s%s\n",
+	"%-*s%*s%*s%*s%*s%s%s%*s%*s%*s%s%*s%6s%*s%*s%s%s%s\n",
 	wide ? 16 : 11, "Name",
-	wide ? 7 : 5, "Size",
+	wide ? 9 : 5, "Size",
 	wide ? 13 : 9, "Requests",
 	wide ? 8 : 5, "Fail",
 	wide ? 13 : 9, "Releases",
@@ -1477,13 +1477,14 @@ dopool_sysctl(int verbose, int wide)
 	wide ? 11 : 6, "Pgreq",
 	wide ? 11 : 6, "Pgrel",
 	wide ? 9 : 6, "Npage",
-	wide ? " PageSz" : "",
+	wide ? "   PageSz" : "",
 	wide ? 8 : 6, "Hiwat",
 	"Minpg",
 	wide ? 9 : 6, "Maxpg",
 	wide ? 8 : 5, "Idle",
 	wide ? "   Flags" : "",
-	wide ? "   Util" : "");
+	wide ? "   Util" : "",
+	wide ? "TotalKB" : "");
 
 	name_len = MIN((int)sizeof(pp->pr_wchan), wide ? 16 : 11);
 	for (i = 0; i < len; ++i) {
@@ -1497,7 +1498,7 @@ dopool_sysctl(int verbose, int wide)
 			pp->pr_maxpages);
 		ovflw = 0;
 		PRWORD(ovflw, "%-*s", name_len, 0, pp->pr_wchan);
-		PRWORD(ovflw, " %*" PRIu64, wide ? 7 : 5, 1, pp->pr_size);
+		PRWORD(ovflw, " %*" PRIu64, wide ? 9 : 5, 1, pp->pr_size);
 		PRWORD(ovflw, " %*" PRIu64, wide ? 13 : 9, 1, pp->pr_nget);
 		pool_totals.pt_nget += pp->pr_nget;
 		PRWORD(ovflw, " %*" PRIu64, wide ? 8 : 5, 1, pp->pr_nfail);
@@ -1517,7 +1518,7 @@ dopool_sysctl(int verbose, int wide)
 		PRWORD(ovflw, " %*" PRIu64, wide ? 9 : 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, 9, 1, pp->pr_pagesize);
 		PRWORD(ovflw, " %*" PRIu64, wide ? 8 : 6, 1, pp->pr_hiwat);
 		PRWORD(ovflw, " %*" PRIu64, 6, 1, pp->pr_minpages);
 		PRWORD(ovflw, " %*s", wide ? 9 : 6, 1, maxp);
@@ -1540,17 +1541,19 @@ dopool_sysctl(int verbose, int wide)
 			total += this_total;
 		}
 		if (wide) {
-			if (this_total == 0)
+			if (this_total == 0) {
 (void)printf("   ---");
-			else
-(void)printf(" %5.1f%%",
-(100.0 * this_inuse) / this_total);
+			} else {
+(void)printf(" %5.1f%% %10" PRIu64,
+(100.0 * this_inuse) / this_total,
+this_total / KILO);
+			}
 		}
 		(void)printf("\n");
 	}
 	ovflw = 0;
 	PRWORD(ovflw, "%-*s", name_len, 0, "Totals");
-	PRWORD(ovflw, " %*s", wide ? 7 : 5, 1, "");
+	PRWORD(ovflw, " %*s", wide ? 9 : 5, 1, "");
 	PRWORD(ovflw, " %*" PRIu64, wide ? 13 : 9, 1, pool_totals.pt_nget);
 	PRWORD(ovflw, " %*" PRIu64, wide ? 8 : 5, 1, pool_totals.pt_nfail);
 	PRWORD(ovflw, " %*" PRIu64, wide ? 13 : 9, 1, pool_totals.pt_nput);
@@ -1616,9 +1619,9 @@ dopool(int verbose, int wide)
 		if (first) {
 			(void)printf("Memory resource pool statistics\n");
 			(void)printf(
-			"%-*s%*s%*s%*s%*s%s%s%*s%*s%*s%s%*s%6s%*s%*s%s%s\n",
+			"%-*s%*s%*s%*s%*s%s%s%*s%*s%*s%s%*s%6s%*s%*s%s%s%s\n",
 			wide ? 16 : 11, "Name",
-			wide ? 7 : 5, "Size",
+			wide ? 9 : 5, "Size",
 			wide ? 13 : 9, "Requests",
 			wide ? 8 : 5, "Fail",
 			wide ? 13 : 9, "Releases",
@@ -1627,13 +1630,14 @@ dopool(int verbose, int wide)
 			wide ? 11 : 6, "Pgreq",
 			wide ? 11 : 6, "Pgrel",
 			wide ? 9 : 6, "Npage",
-			wide ? " PageSz" : "",
+			wide ? "   PageSz" : "",
 			wide ? 8 : 6, "Hiwat",
 			"Minpg",
 			wide ? 9 : 6, "Maxpg",
 			wide ? 8 : 5, "Idle",
 			wide ? "   Flags" : "",
-			wide ? "   Util" : "");
+			wide ? "   Util" : "",
+			wide ? "TotalKB" : "");
 			first = 0;
 		}
 		if (pp->pr_nget == 0 && !verbose)
@@ -1645,7 +1649,7 @@ dopool(int verbose, int wide)
 			pp->pr_maxpages);
 		ovflw = 0;
 		PRWORD(ovflw, "%-*s", wide ? 16 : 11, 0, name);
-		PRWORD(ovflw, " 

CVS commit: src/usr.bin/vmstat

2023-07-31 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Tue Aug  1 04:20:14 UTC 2023

Modified Files:
src/usr.bin/vmstat: vmstat.c

Log Message:
For vmstat -mW, add a total KB consumed column and widen a couple of
other fields.


To generate a diff of this commit:
cvs rdiff -u -r1.256 -r1.257 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.



CVS commit: src/usr.bin/vmstat

2022-10-23 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sun Oct 23 23:30:31 UTC 2022

Modified Files:
src/usr.bin/vmstat: vmstat.c

Log Message:
Remove extraneous "d" in a printf format string in UVM history dump
(leftover int format specifier from conversion to FMTd32?).


To generate a diff of this commit:
cvs rdiff -u -r1.255 -r1.256 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.255 src/usr.bin/vmstat/vmstat.c:1.256
--- src/usr.bin/vmstat/vmstat.c:1.255	Sat Jul 16 10:36:19 2022
+++ src/usr.bin/vmstat/vmstat.c	Sun Oct 23 23:30:31 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: vmstat.c,v 1.255 2022/07/16 10:36:19 simonb Exp $ */
+/* $NetBSD: vmstat.c,v 1.256 2022/10/23 23:30:31 simonb Exp $ */
 
 /*-
  * Copyright (c) 1998, 2000, 2001, 2007, 2019, 2020
@@ -71,7 +71,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.255 2022/07/16 10:36:19 simonb Exp $");
+__RCSID("$NetBSD: vmstat.c,v 1.256 2022/10/23 23:30:31 simonb Exp $");
 #endif
 #endif /* not lint */
 
@@ -2299,7 +2299,7 @@ hist_dodump(struct kern_history *histp)
 			bintime2timeval(>bt, );
 			(void)printf("%06ld.%06ld ", (long int)tv.tv_sec,
 			(long int)tv.tv_usec);
-			(void)printf("%s#%" PRId32 "@%" PRId32 "d: ",
+			(void)printf("%s#%" PRId32 "@%" PRId32 ": ",
 			fn, e->call, e->cpunum);
 			(void)printf(fmt, e->v[0], e->v[1], e->v[2], e->v[3]);
 			(void)putchar('\n');



CVS commit: src/usr.bin/vmstat

2022-10-23 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sun Oct 23 23:30:31 UTC 2022

Modified Files:
src/usr.bin/vmstat: vmstat.c

Log Message:
Remove extraneous "d" in a printf format string in UVM history dump
(leftover int format specifier from conversion to FMTd32?).


To generate a diff of this commit:
cvs rdiff -u -r1.255 -r1.256 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.



CVS commit: src/usr.bin/vmstat

2022-07-16 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sat Jul 16 10:36:19 UTC 2022

Modified Files:
src/usr.bin/vmstat: vmstat.c

Log Message:
When operating on core files or /dev/mem when using the -M option,
use 64-bit math to calculate pool sizes.  Fixes overflow errors for
pools larger than 4GB and gives the correct output with "vmstat -m"
for in use, total allocation and utilisation numbers.


To generate a diff of this commit:
cvs rdiff -u -r1.254 -r1.255 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.254 src/usr.bin/vmstat/vmstat.c:1.255
--- src/usr.bin/vmstat/vmstat.c:1.254	Sat Jul 16 09:32:27 2022
+++ src/usr.bin/vmstat/vmstat.c	Sat Jul 16 10:36:19 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: vmstat.c,v 1.254 2022/07/16 09:32:27 simonb Exp $ */
+/* $NetBSD: vmstat.c,v 1.255 2022/07/16 10:36:19 simonb Exp $ */
 
 /*-
  * Copyright (c) 1998, 2000, 2001, 2007, 2019, 2020
@@ -71,7 +71,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.254 2022/07/16 09:32:27 simonb Exp $");
+__RCSID("$NetBSD: vmstat.c,v 1.255 2022/07/16 10:36:19 simonb Exp $");
 #endif
 #endif /* not lint */
 
@@ -1578,7 +1578,7 @@ dopool(int verbose, int wide)
 {
 	int first, ovflw;
 	void *addr;
-	long total, inuse, this_total, this_inuse;
+	uint64_t total, inuse, this_total, this_inuse;
 	struct {
 		uint64_t pt_nget;
 		uint64_t pt_nfail;
@@ -1674,8 +1674,8 @@ dopool(int verbose, int wide)
 			PRWORD(ovflw, " 0x%0*x", 6, 1,
 			pp->pr_flags | pp->pr_roflags);
 
-		this_inuse = pp->pr_nout * pp->pr_size;
-		this_total = pp->pr_npages * pa.pa_pagesz;
+		this_inuse = (uint64_t)pp->pr_nout * pp->pr_size;
+		this_total = (uint64_t)pp->pr_npages * pa.pa_pagesz;
 		if (pp->pr_roflags & PR_RECURSIVE) {
 			/*
 			 * Don't count in-use memory, since it's part
@@ -1714,7 +1714,8 @@ dopool(int verbose, int wide)
 	inuse /= KILO;
 	total /= KILO;
 	(void)printf(
-	"\nIn use %ldK, total allocated %ldK; utilization %.1f%%\n",
+	"\nIn use %" PRIu64 "K, "
+	"total allocated %" PRIu64 "K; utilization %.1f%%\n",
 	inuse, total, (100.0 * inuse) / total);
 }
 



CVS commit: src/usr.bin/vmstat

2022-07-16 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sat Jul 16 10:36:19 UTC 2022

Modified Files:
src/usr.bin/vmstat: vmstat.c

Log Message:
When operating on core files or /dev/mem when using the -M option,
use 64-bit math to calculate pool sizes.  Fixes overflow errors for
pools larger than 4GB and gives the correct output with "vmstat -m"
for in use, total allocation and utilisation numbers.


To generate a diff of this commit:
cvs rdiff -u -r1.254 -r1.255 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.



CVS commit: src/usr.bin/vmstat

2022-07-16 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sat Jul 16 09:32:27 UTC 2022

Modified Files:
src/usr.bin/vmstat: vmstat.c

Log Message:
Move the call to getnlist() to after we check if kvm_openfiles(3) succeeded.
Avoids a coredump when called with "vmstat -M /dev/mem".


To generate a diff of this commit:
cvs rdiff -u -r1.253 -r1.254 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.253 src/usr.bin/vmstat/vmstat.c:1.254
--- src/usr.bin/vmstat/vmstat.c:1.253	Thu May 19 13:57:03 2022
+++ src/usr.bin/vmstat/vmstat.c	Sat Jul 16 09:32:27 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: vmstat.c,v 1.253 2022/05/19 13:57:03 simonb Exp $ */
+/* $NetBSD: vmstat.c,v 1.254 2022/07/16 09:32:27 simonb Exp $ */
 
 /*-
  * Copyright (c) 1998, 2000, 2001, 2007, 2019, 2020
@@ -71,7 +71,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.253 2022/05/19 13:57:03 simonb Exp $");
+__RCSID("$NetBSD: vmstat.c,v 1.254 2022/07/16 09:32:27 simonb Exp $");
 #endif
 #endif /* not lint */
 
@@ -422,12 +422,14 @@ main(int argc, char *argv[])
 		kd = kvm_openfiles(NULL, NULL, NULL, KVM_NO_FILES, errbuf);
 	} else {
 		kd = kvm_openfiles(nlistf, memf, NULL, O_RDONLY, errbuf);
-		getnlist(todo);
 	}
 
 	if (kd == NULL)
 		errx(EXIT_FAILURE, "%s", errbuf);
 
+	if (memf != NULL)
+		getnlist(todo);	/* Only need this if a core is specified. */
+
 	if (todo & VMSTAT) {
 		struct winsize winsize;
 



CVS commit: src/usr.bin/vmstat

2022-07-16 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sat Jul 16 09:32:27 UTC 2022

Modified Files:
src/usr.bin/vmstat: vmstat.c

Log Message:
Move the call to getnlist() to after we check if kvm_openfiles(3) succeeded.
Avoids a coredump when called with "vmstat -M /dev/mem".


To generate a diff of this commit:
cvs rdiff -u -r1.253 -r1.254 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.



CVS commit: src/usr.bin/vmstat

2022-05-19 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Thu May 19 13:57:03 UTC 2022

Modified Files:
src/usr.bin/vmstat: vmstat.c

Log Message:
Bump some column widths for "vmstat -mW".


To generate a diff of this commit:
cvs rdiff -u -r1.252 -r1.253 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.252 src/usr.bin/vmstat/vmstat.c:1.253
--- src/usr.bin/vmstat/vmstat.c:1.252	Sun Feb 27 19:00:46 2022
+++ src/usr.bin/vmstat/vmstat.c	Thu May 19 13:57:03 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: vmstat.c,v 1.252 2022/02/27 19:00:46 rillig Exp $ */
+/* $NetBSD: vmstat.c,v 1.253 2022/05/19 13:57:03 simonb Exp $ */
 
 /*-
  * Copyright (c) 1998, 2000, 2001, 2007, 2019, 2020
@@ -71,7 +71,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.252 2022/02/27 19:00:46 rillig Exp $");
+__RCSID("$NetBSD: vmstat.c,v 1.253 2022/05/19 13:57:03 simonb Exp $");
 #endif
 #endif /* not lint */
 
@@ -1464,22 +1464,22 @@ dopool_sysctl(int verbose, int wide)
 
 	(void)printf("Memory resource pool statistics\n");
 	(void)printf(
-	"%-*s%*s%*s%*s%*s%s%s%*s%*s%*s%s%*s%6s%*s%5s%s%s\n",
+	"%-*s%*s%*s%*s%*s%s%s%*s%*s%*s%s%*s%6s%*s%*s%s%s\n",
 	wide ? 16 : 11, "Name",
 	wide ? 7 : 5, "Size",
-	wide ? 12 : 9, "Requests",
+	wide ? 13 : 9, "Requests",
 	wide ? 8 : 5, "Fail",
-	wide ? 12 : 9, "Releases",
+	wide ? 13 : 9, "Releases",
 	wide ? "InUse" : "",
 	wide ? "Avail" : "",
 	wide ? 11 : 6, "Pgreq",
 	wide ? 11 : 6, "Pgrel",
-	wide ? 8 : 6, "Npage",
+	wide ? 9 : 6, "Npage",
 	wide ? " PageSz" : "",
-	wide ? 7 : 6, "Hiwat",
+	wide ? 8 : 6, "Hiwat",
 	"Minpg",
-	wide ? 7 : 6, "Maxpg",
-	"Idle",
+	wide ? 9 : 6, "Maxpg",
+	wide ? 8 : 5, "Idle",
 	wide ? "   Flags" : "",
 	wide ? "   Util" : "");
 
@@ -1496,11 +1496,11 @@ dopool_sysctl(int verbose, int wide)
 		ovflw = 0;
 		PRWORD(ovflw, "%-*s", name_len, 0, pp->pr_wchan);
 		PRWORD(ovflw, " %*" PRIu64, wide ? 7 : 5, 1, pp->pr_size);
-		PRWORD(ovflw, " %*" PRIu64, wide ? 12 : 9, 1, pp->pr_nget);
+		PRWORD(ovflw, " %*" PRIu64, wide ? 13 : 9, 1, pp->pr_nget);
 		pool_totals.pt_nget += pp->pr_nget;
 		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);
+		PRWORD(ovflw, " %*" PRIu64, wide ? 13 : 9, 1, pp->pr_nput);
 		pool_totals.pt_nput += pp->pr_nput;
 		if (wide) {
 			PRWORD(ovflw, " %*" PRIu64, 9, 1, pp->pr_nout);
@@ -1512,14 +1512,14 @@ dopool_sysctl(int verbose, int wide)
 		pool_totals.pt_npagealloc += pp->pr_npagealloc;
 		PRWORD(ovflw, " %*" PRIu64, wide ? 11 : 6, 1, pp->pr_npagefree);
 		pool_totals.pt_npagefree += pp->pr_npagefree;
-		PRWORD(ovflw, " %*" PRIu64, wide ? 8 : 6, 1, pp->pr_npages);
+		PRWORD(ovflw, " %*" PRIu64, wide ? 9 : 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, wide ? 7 : 6, 1, pp->pr_hiwat);
+		PRWORD(ovflw, " %*" PRIu64, wide ? 8 : 6, 1, pp->pr_hiwat);
 		PRWORD(ovflw, " %*" PRIu64, 6, 1, pp->pr_minpages);
-		PRWORD(ovflw, " %*s", wide ? 7 : 6, 1, maxp);
-		PRWORD(ovflw, " %*" PRIu64, 5, 1, pp->pr_nidle);
+		PRWORD(ovflw, " %*s", wide ? 9 : 6, 1, maxp);
+		PRWORD(ovflw, " %*" PRIu64, wide ? 8 : 5, 1, pp->pr_nidle);
 		if (wide)
 			PRWORD(ovflw, " 0x%0*" PRIx64, 6, 1,
 			pp->pr_flags);
@@ -1549,16 +1549,16 @@ dopool_sysctl(int verbose, int wide)
 	ovflw = 0;
 	PRWORD(ovflw, "%-*s", name_len, 0, "Totals");
 	PRWORD(ovflw, " %*s", wide ? 7 : 5, 1, "");
-	PRWORD(ovflw, " %*" PRIu64, wide ? 12 : 9, 1, pool_totals.pt_nget);
+	PRWORD(ovflw, " %*" PRIu64, wide ? 13 : 9, 1, pool_totals.pt_nget);
 	PRWORD(ovflw, " %*" PRIu64, wide ? 8 : 5, 1, pool_totals.pt_nfail);
-	PRWORD(ovflw, " %*" PRIu64, wide ? 12 : 9, 1, pool_totals.pt_nput);
+	PRWORD(ovflw, " %*" PRIu64, wide ? 13 : 9, 1, pool_totals.pt_nput);
 	if (wide) {
 		PRWORD(ovflw, " %*" PRIu64, 9, 1, pool_totals.pt_nout);
 		PRWORD(ovflw, " %*" PRIu64, 9, 1, pool_totals.pt_nitems);
 	}
 	PRWORD(ovflw, " %*" PRIu64, wide ? 11 : 6, 1, pool_totals.pt_npagealloc);
 	PRWORD(ovflw, " %*" PRIu64, wide ? 11 : 6, 1, pool_totals.pt_npagefree);
-	PRWORD(ovflw, " %*" PRIu64, wide ? 8 : 6, 1, pool_totals.pt_npages);
+	PRWORD(ovflw, " %*" PRIu64, wide ? 9 : 6, 1, pool_totals.pt_npages);
 	(void)printf("\n");
 
 	inuse /= KILO;
@@ -1614,22 +1614,22 @@ dopool(int verbose, int wide)
 		if (first) {
 			(void)printf("Memory resource pool statistics\n");
 			(void)printf(
-			"%-*s%*s%*s%*s%*s%s%s%*s%*s%*s%s%*s%6s%*s%5s%s%s\n",
+			"%-*s%*s%*s%*s%*s%s%s%*s%*s%*s%s%*s%6s%*s%*s%s%s\n",
 			wide ? 16 : 11, 

CVS commit: src/usr.bin/vmstat

2022-05-19 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Thu May 19 13:57:03 UTC 2022

Modified Files:
src/usr.bin/vmstat: vmstat.c

Log Message:
Bump some column widths for "vmstat -mW".


To generate a diff of this commit:
cvs rdiff -u -r1.252 -r1.253 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.



re: CVS commit: src/usr.bin/vmstat

2022-02-28 Thread matthew green
"Roland Illig" writes:
> Module Name:  src
> Committed By: rillig
> Date: Sun Feb 27 19:00:46 UTC 2022
>
> Modified Files:
>   src/usr.bin/vmstat: vmstat.c
>
> Log Message:
> vmstat: unexport file-scope variable numdisks
>
> There is no need to make this variable externally visible.  There are
> several more variables in this file that could be unexported, leave
> these for someone who knows whether vmstat.c is used by other parts of
> the tree as well.
>
> No functional change, OK mrg.

thanks!


CVS commit: src/usr.bin/vmstat

2022-02-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb 27 19:00:46 UTC 2022

Modified Files:
src/usr.bin/vmstat: vmstat.c

Log Message:
vmstat: unexport file-scope variable numdisks

There is no need to make this variable externally visible.  There are
several more variables in this file that could be unexported, leave
these for someone who knows whether vmstat.c is used by other parts of
the tree as well.

No functional change, OK mrg.


To generate a diff of this commit:
cvs rdiff -u -r1.251 -r1.252 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.251 src/usr.bin/vmstat/vmstat.c:1.252
--- src/usr.bin/vmstat/vmstat.c:1.251	Wed Feb  9 07:51:45 2022
+++ src/usr.bin/vmstat/vmstat.c	Sun Feb 27 19:00:46 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: vmstat.c,v 1.251 2022/02/09 07:51:45 wiz Exp $ */
+/* $NetBSD: vmstat.c,v 1.252 2022/02/27 19:00:46 rillig Exp $ */
 
 /*-
  * Copyright (c) 1998, 2000, 2001, 2007, 2019, 2020
@@ -71,7 +71,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.251 2022/02/09 07:51:45 wiz Exp $");
+__RCSID("$NetBSD: vmstat.c,v 1.252 2022/02/27 19:00:46 rillig Exp $");
 #endif
 #endif /* not lint */
 
@@ -329,7 +329,7 @@ static const int vmmeter_mib[] = { CTL_V
 static const int uvmexp2_mib[] = { CTL_VM, VM_UVMEXP2 };
 static const int boottime_mib[] = { CTL_KERN, KERN_BOOTTIME };
 
-int numdisks = 2;
+static int numdisks = 2;
 
 int
 main(int argc, char *argv[])



CVS commit: src/usr.bin/vmstat

2022-02-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb 27 19:00:46 UTC 2022

Modified Files:
src/usr.bin/vmstat: vmstat.c

Log Message:
vmstat: unexport file-scope variable numdisks

There is no need to make this variable externally visible.  There are
several more variables in this file that could be unexported, leave
these for someone who knows whether vmstat.c is used by other parts of
the tree as well.

No functional change, OK mrg.


To generate a diff of this commit:
cvs rdiff -u -r1.251 -r1.252 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.



re: CVS commit: src/usr.bin/vmstat

2022-02-27 Thread matthew green
Roland Illig writes:
> Am 09.02.2022 um 08:34 schrieb matthew green:
> > Module Name:src
> > Committed By:   mrg
> > Date:   Wed Feb  9 07:34:18 UTC 2022
> >
> > Modified Files:
> > src/usr.bin/vmstat: vmstat.c
> >
> > Log Message:
> > allow the number of disks displayed in the default output
> > to be controlled.
> >
> >
> > To generate a diff of this commit:
> > cvs rdiff -u -r1.249 -r1.250 src/usr.bin/vmstat/vmstat.c
>
> Did you omit the "static" from the variable definition on purpose?  As a
> general rule, I prefer to keep the scope of each variable as narrow as
> possible.

good idea.  feel free to fix, i usually do this :-)


Re: CVS commit: src/usr.bin/vmstat

2022-02-26 Thread Roland Illig

Am 09.02.2022 um 08:34 schrieb matthew green:

Module Name:src
Committed By:   mrg
Date:   Wed Feb  9 07:34:18 UTC 2022

Modified Files:
src/usr.bin/vmstat: vmstat.c

Log Message:
allow the number of disks displayed in the default output
to be controlled.


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


Did you omit the "static" from the variable definition on purpose?  As a
general rule, I prefer to keep the scope of each variable as narrow as
possible.

Roland


CVS commit: src/usr.bin/vmstat

2022-02-08 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Wed Feb  9 07:51:45 UTC 2022

Modified Files:
src/usr.bin/vmstat: vmstat.c

Log Message:
Fix typo in usage.


To generate a diff of this commit:
cvs rdiff -u -r1.250 -r1.251 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.



CVS commit: src/usr.bin/vmstat

2022-02-08 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Wed Feb  9 07:51:45 UTC 2022

Modified Files:
src/usr.bin/vmstat: vmstat.c

Log Message:
Fix typo in usage.


To generate a diff of this commit:
cvs rdiff -u -r1.250 -r1.251 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.250 src/usr.bin/vmstat/vmstat.c:1.251
--- src/usr.bin/vmstat/vmstat.c:1.250	Wed Feb  9 07:34:18 2022
+++ src/usr.bin/vmstat/vmstat.c	Wed Feb  9 07:51:45 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: vmstat.c,v 1.250 2022/02/09 07:34:18 mrg Exp $ */
+/* $NetBSD: vmstat.c,v 1.251 2022/02/09 07:51:45 wiz Exp $ */
 
 /*-
  * Copyright (c) 1998, 2000, 2001, 2007, 2019, 2020
@@ -71,7 +71,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.250 2022/02/09 07:34:18 mrg Exp $");
+__RCSID("$NetBSD: vmstat.c,v 1.251 2022/02/09 07:51:45 wiz Exp $");
 #endif
 #endif /* not lint */
 
@@ -2442,7 +2442,7 @@ usage(void)
 
 	(void)fprintf(stderr,
 	"usage: %s [-CefHiLlmstUvW] [-c count] [-h hashname]\n"
-	"\t\t[-M core] [-N system] [-d diskcount] [-u histname]\n"
+	"\t\t[-M core] [-N system] [-n diskcount] [-u histname]\n"
 	"[-w wait] [disks]\n",
 	getprogname());
 	exit(1);



CVS commit: src/usr.bin/vmstat

2022-02-08 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Feb  9 07:34:18 UTC 2022

Modified Files:
src/usr.bin/vmstat: vmstat.c

Log Message:
allow the number of disks displayed in the default output
to be controlled.


To generate a diff of this commit:
cvs rdiff -u -r1.249 -r1.250 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.249 src/usr.bin/vmstat/vmstat.c:1.250
--- src/usr.bin/vmstat/vmstat.c:1.249	Tue Feb  1 09:18:07 2022
+++ src/usr.bin/vmstat/vmstat.c	Wed Feb  9 07:34:18 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: vmstat.c,v 1.249 2022/02/01 09:18:07 mrg Exp $ */
+/* $NetBSD: vmstat.c,v 1.250 2022/02/09 07:34:18 mrg Exp $ */
 
 /*-
  * Copyright (c) 1998, 2000, 2001, 2007, 2019, 2020
@@ -71,7 +71,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.249 2022/02/01 09:18:07 mrg Exp $");
+__RCSID("$NetBSD: vmstat.c,v 1.250 2022/02/09 07:34:18 mrg Exp $");
 #endif
 #endif /* not lint */
 
@@ -329,6 +329,8 @@ static const int vmmeter_mib[] = { CTL_V
 static const int uvmexp2_mib[] = { CTL_VM, VM_UVMEXP2 };
 static const int boottime_mib[] = { CTL_KERN, KERN_BOOTTIME };
 
+int numdisks = 2;
+
 int
 main(int argc, char *argv[])
 {
@@ -343,7 +345,7 @@ main(int argc, char *argv[])
 	reps = todo = verbose = wide = 0;
 	interval.tv_sec = 0;
 	interval.tv_nsec = 0;
-	while ((c = getopt(argc, argv, "Cc:efh:HilLM:mN:stu:UvWw:")) != -1) {
+	while ((c = getopt(argc, argv, "Cc:efh:HilLM:mN:n:stu:UvWw:")) != -1) {
 		switch (c) {
 		case 'c':
 			reps = atoi(optarg);
@@ -381,6 +383,9 @@ main(int argc, char *argv[])
 		case 'N':
 			nlistf = optarg;
 			break;
+		case 'n':
+			numdisks = atoi(optarg);
+			break;
 		case 's':
 			todo |= SUMSTAT;
 			break;
@@ -595,10 +600,10 @@ choosedrives(char **argv)
 	/*
 	 * Pick the most active drives.  Must read the stats once before
 	 * sorting so that there is current IO data, before selecting
-	 * just the first two drives.
+	 * just the first 'numdisks' (default 2) drives.
 	 */
 	drvreadstats();
-	for (i = 0; i < ndrive && ndrives < 2; i++) {
+	for (i = 0; i < ndrive && ndrives < numdisks; i++) {
 		uint64_t high_bytes = 0, bytes;
 
 		k = ndrive;
@@ -2436,7 +2441,9 @@ usage(void)
 {
 
 	(void)fprintf(stderr,
-	"usage: %s [-CefHiLlmstUvW] [-c count] [-h hashname] [-M core] [-N system]\n"
-	"\t\t[-u histname] [-w wait] [disks]\n", getprogname());
+	"usage: %s [-CefHiLlmstUvW] [-c count] [-h hashname]\n"
+	"\t\t[-M core] [-N system] [-d diskcount] [-u histname]\n"
+	"[-w wait] [disks]\n",
+	getprogname());
 	exit(1);
 }



CVS commit: src/usr.bin/vmstat

2022-02-08 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Feb  9 07:34:18 UTC 2022

Modified Files:
src/usr.bin/vmstat: vmstat.c

Log Message:
allow the number of disks displayed in the default output
to be controlled.


To generate a diff of this commit:
cvs rdiff -u -r1.249 -r1.250 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.



CVS commit: src/usr.bin/vmstat

2022-02-08 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Feb  9 07:34:08 UTC 2022

Modified Files:
src/usr.bin/vmstat: vmstat.1

Log Message:
allow the number of disks displayed in the default output
to be controlled.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/usr.bin/vmstat/vmstat.1

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.1
diff -u src/usr.bin/vmstat/vmstat.1:1.25 src/usr.bin/vmstat/vmstat.1:1.26
--- src/usr.bin/vmstat/vmstat.1:1.25	Mon Dec 13 08:19:12 2021
+++ src/usr.bin/vmstat/vmstat.1	Wed Feb  9 07:34:08 2022
@@ -1,4 +1,4 @@
-.\"	$NetBSD: vmstat.1,v 1.25 2021/12/13 08:19:12 simonb Exp $
+.\"	$NetBSD: vmstat.1,v 1.26 2022/02/09 07:34:08 mrg Exp $
 .\"
 .\" Copyright (c) 2000, 2007 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -53,7 +53,7 @@
 .\"
 .\"	@(#)vmstat.8	8.1 (Berkeley) 6/6/93
 .\"
-.Dd December 13, 2021
+.Dd February 1, 2022
 .Dt VMSTAT 1
 .Os
 .Sh NAME
@@ -66,6 +66,7 @@
 .Op Fl h Ar hashname
 .Op Fl M Ar core
 .Op Fl N Ar system
+.Op Fl n Ar diskcount
 .Op Fl u Ar histname
 .Op Fl w Ar wait
 .Op Ar disks
@@ -123,6 +124,10 @@ Report on the list of the kernel memory 
 .It Fl N Ar system
 Extract the name list from the specified system instead of the default
 .Pa /netbsd .
+.It Fl n Ar diskcount
+Display up to
+.Ar diskcount
+disks in the standard output, instead of the default 2.
 .It Fl s
 Display the contents of the
 .Dv uvmexp
@@ -300,7 +305,8 @@ apparent which are recomputed every seco
 .Xr kernhist 9
 .Sh BUGS
 The
-.Fl c
+.Fl c ,
+.Fl n ,
 and
 .Fl w
 options are only available with the default output.



CVS commit: src/usr.bin/vmstat

2022-02-08 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Feb  9 07:34:08 UTC 2022

Modified Files:
src/usr.bin/vmstat: vmstat.1

Log Message:
allow the number of disks displayed in the default output
to be controlled.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/usr.bin/vmstat/vmstat.1

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



CVS commit: src/usr.bin/vmstat

2022-02-01 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Feb  1 09:18:07 UTC 2022

Modified Files:
src/usr.bin/vmstat: vmstat.c

Log Message:
when picking which 2 disks to show in the 'vmstat' default output
and they haven't been specified on the command line, pick the two
devices that have had the largest read+write IO bytes count.


To generate a diff of this commit:
cvs rdiff -u -r1.248 -r1.249 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.248 src/usr.bin/vmstat/vmstat.c:1.249
--- src/usr.bin/vmstat/vmstat.c:1.248	Sat Nov 27 22:16:42 2021
+++ src/usr.bin/vmstat/vmstat.c	Tue Feb  1 09:18:07 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: vmstat.c,v 1.248 2021/11/27 22:16:42 rillig Exp $ */
+/* $NetBSD: vmstat.c,v 1.249 2022/02/01 09:18:07 mrg Exp $ */
 
 /*-
  * Copyright (c) 1998, 2000, 2001, 2007, 2019, 2020
@@ -71,7 +71,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.248 2021/11/27 22:16:42 rillig Exp $");
+__RCSID("$NetBSD: vmstat.c,v 1.249 2022/02/01 09:18:07 mrg Exp $");
 #endif
 #endif /* not lint */
 
@@ -569,7 +569,7 @@ getnlist(int todo)
 char **
 choosedrives(char **argv)
 {
-	size_t i;
+	size_t i, j, k;
 
 	/*
 	 * Choose drives to be displayed.  Priority goes to (in order) drives
@@ -591,11 +591,30 @@ choosedrives(char **argv)
 			break;
 		}
 	}
+
+	/*
+	 * Pick the most active drives.  Must read the stats once before
+	 * sorting so that there is current IO data, before selecting
+	 * just the first two drives.
+	 */
+	drvreadstats();
 	for (i = 0; i < ndrive && ndrives < 2; i++) {
-		if (drv_select[i])
-			continue;
-		drv_select[i] = 1;
-		++ndrives;
+		uint64_t high_bytes = 0, bytes;
+
+		k = ndrive;
+		for (j = 0; j < ndrive; j++) {
+			if (drv_select[j])
+continue;
+			bytes = cur.rbytes[j] + cur.wbytes[j];
+			if (bytes > high_bytes) {
+high_bytes = bytes;
+k = j;
+			}
+		}
+		if (k != ndrive) {
+			drv_select[k] = 1;
+			++ndrives;
+		}
 	}
 
 	return (argv);



CVS commit: src/usr.bin/vmstat

2022-02-01 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Feb  1 09:18:07 UTC 2022

Modified Files:
src/usr.bin/vmstat: vmstat.c

Log Message:
when picking which 2 disks to show in the 'vmstat' default output
and they haven't been specified on the command line, pick the two
devices that have had the largest read+write IO bytes count.


To generate a diff of this commit:
cvs rdiff -u -r1.248 -r1.249 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.



CVS commit: src/usr.bin/vmstat

2021-12-13 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Dec 13 08:19:12 UTC 2021

Modified Files:
src/usr.bin/vmstat: vmstat.1

Log Message:
Update -m description to reflect reality.  Kernel dynamic memory tracking
was removed long ago; only pool usage is reported.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/usr.bin/vmstat/vmstat.1

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.1
diff -u src/usr.bin/vmstat/vmstat.1:1.24 src/usr.bin/vmstat/vmstat.1:1.25
--- src/usr.bin/vmstat/vmstat.1:1.24	Tue Dec 25 03:38:59 2018
+++ src/usr.bin/vmstat/vmstat.1	Mon Dec 13 08:19:12 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: vmstat.1,v 1.24 2018/12/25 03:38:59 sevan Exp $
+.\"	$NetBSD: vmstat.1,v 1.25 2021/12/13 08:19:12 simonb Exp $
 .\"
 .\" Copyright (c) 2000, 2007 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -53,7 +53,7 @@
 .\"
 .\"	@(#)vmstat.8	8.1 (Berkeley) 6/6/93
 .\"
-.Dd December 25, 2018
+.Dd December 13, 2021
 .Dt VMSTAT 1
 .Os
 .Sh NAME
@@ -119,9 +119,7 @@ Extract values associated with the name 
 instead of the default
 .Pa /dev/mem .
 .It Fl m
-Report on the usage of kernel dynamic memory listed first by size of
-allocation and then by type of usage,
-followed by a list of the kernel memory pools and their usage.
+Report on the list of the kernel memory pools and their usage.
 .It Fl N Ar system
 Extract the name list from the specified system instead of the default
 .Pa /netbsd .



CVS commit: src/usr.bin/vmstat

2021-12-13 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Dec 13 08:19:12 UTC 2021

Modified Files:
src/usr.bin/vmstat: vmstat.1

Log Message:
Update -m description to reflect reality.  Kernel dynamic memory tracking
was removed long ago; only pool usage is reported.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/usr.bin/vmstat/vmstat.1

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



Re: CVS commit: src/usr.bin/vmstat

2018-12-13 Thread Sevan Janiyan
On 13/12/2018 04:00, Simon Burge wrote:
> While a bit wordier, I think that accurately describes the behaviour.
> LGTM.

Thanks. I had one other thought which I haven't investigated yet but did
we change behaviour intentionally? My committed change complements the
description of -c
"Repeat the display count times.  The first display is for the time
since a reboot and each subsequent report is for the time period since
the last display.  If no wait interval is specified, the default is 1
second."

The other thing was that prior to my commit, I was testing things on an
i7 and there the run queue doesn't change. When you followed up post
commit, I checked on a uniprocessor system & there the run queue does
register.
I want to explore that too and document further (heads up) aside from
this scenario with the first line.


Sevan


Re: CVS commit: src/usr.bin/vmstat

2018-12-12 Thread Simon Burge
Hi Sevan,

Sevan Janiyan wrote:

> How about this?
>
> Index: usr.bin/vmstat/vmstat.1
> ===
> RCS file: /cvsroot/src/usr.bin/vmstat/vmstat.1,v
> retrieving revision 1.23
> diff -u -p -r1.23 vmstat.1
> --- usr.bin/vmstat/vmstat.1 13 Dec 2018 01:29:10 -  1.23
> +++ usr.bin/vmstat/vmstat.1 13 Dec 2018 02:50:00 -
> @@ -76,9 +76,17 @@ disk, trap, and CPU activity.
>  If
>  .Nm
>  is invoked without any options, it displays the summary of statistics since
> -boot and exits.
> +boot for all fields except memory and process statistic then exits.
> +The memory and process fields are live samples taken at the time
> +.Nm
> +was invoked in this implementation.
>  This is also referred to as the first line of
>  .Nm .
> +The
> +.Fl N ,
> +.Fl v ,
> +.Fl W
> +options adhere to this behaviour.
>  .Pp
>  The options are as follows:
>  .Bl -tag -width xxxhistname

While a bit wordier, I think that accurately describes the behaviour.
LGTM.

Cheers,
Simon.


Re: CVS commit: src/usr.bin/vmstat

2018-12-12 Thread Sevan Janiyan
How about this?

Index: usr.bin/vmstat/vmstat.1
===
RCS file: /cvsroot/src/usr.bin/vmstat/vmstat.1,v
retrieving revision 1.23
diff -u -p -r1.23 vmstat.1
--- usr.bin/vmstat/vmstat.1 13 Dec 2018 01:29:10 -  1.23
+++ usr.bin/vmstat/vmstat.1 13 Dec 2018 02:50:00 -
@@ -76,9 +76,17 @@ disk, trap, and CPU activity.
 If
 .Nm
 is invoked without any options, it displays the summary of statistics since
-boot and exits.
+boot for all fields except memory and process statistic then exits.
+The memory and process fields are live samples taken at the time
+.Nm
+was invoked in this implementation.
 This is also referred to as the first line of
 .Nm .
+The
+.Fl N ,
+.Fl v ,
+.Fl W
+options adhere to this behaviour.
 .Pp
 The options are as follows:
 .Bl -tag -width xxxhistname



Re: CVS commit: src/usr.bin/vmstat

2018-12-12 Thread Sevan Janiyan
Hi Simon,

On 13/12/2018 02:14, Simon Burge wrote:
>   +If
>   +.Nm
>   +is invoked without any options, it displays the summary of statistics since
>   +boot and exits.
> 
> That's not true for the process and memory info though, right?  For
> those two these are their current state, not a summary since boot.  Also
> technically a few options don't change this behaviour either (at least
> -M -N -v and -W?).
> 
> Not sure how we should document all this and be correct at the same
> time. :)

Yes you are right. When you invoke it over and over, free memory
changes. then the run queue if you specify an option.
play$ vmstat
 procsmemory  page   disk faults  cpu
 r b  avmfre  flt  re  pi   po   fr   sr l0   in   sy  cs us sy id
 1 0   502920  18484  229   0   0056 18   21 7949  62  2  1 97
play$ vmstat
 procsmemory  page   disk faults  cpu
 r b  avmfre  flt  re  pi   po   fr   sr l0   in   sy  cs us sy id
 1 0   502920  18484  229   0   0056 18   21 7949  62  2  1 97
play$ vmstat
 procsmemory  page   disk faults  cpu
 r b  avmfre  flt  re  pi   po   fr   sr l0   in   sy  cs us sy id
 1 0   502920  18488  229   0   0056 18   21 7949  62  2  1 97
play$ vmstat
 procsmemory  page   disk faults  cpu
 r b  avmfre  flt  re  pi   po   fr   sr l0   in   sy  cs us sy id
 1 0   502920  18484  229   0   0056 18   21 7949  62  2  1 97
play$ vmstat
 procsmemory  page   disk faults  cpu
 r b  avmfre  flt  re  pi   po   fr   sr l0   in   sy  cs us sy id
 1 0   502924  18480  229   0   0056 18   21 7949  62  2  1 97
play$ vmstat
 procsmemory  page   disk faults  cpu
 r b  avmfre  flt  re  pi   po   fr   sr l0   in   sy  cs us sy id
 1 0   502924  18480  229   0   0056 18   21 7949  62  2  1 97
play$ vmstat
 procsmemory  page   disk faults  cpu
 r b  avmfre  flt  re  pi   po   fr   sr l0   in   sy  cs us sy id
 1 0   502920  18488  229   0   0056 18   21 7949  62  2  1 97
play$ vmstat -c 3
 procsmemory  page   disk faults  cpu
 r b  avmfre  flt  re  pi   po   fr   sr l0   in   sy  cs us sy id
 2 0   502920  18484  229   0   0056 18   21 7949  62  2  1 97
 0 0   502920  184840   0   0000  07   62  23  0 0 100
 0 0   502924  184841   0   0000  07   58  26  0 0 100


Re: CVS commit: src/usr.bin/vmstat

2018-12-12 Thread Simon Burge
Hi Sevan,

"Sevan Janiyan" wrote:

> Module Name:  src
> Committed By: sevan
> Date: Thu Dec 13 01:29:11 UTC 2018
>
> Modified Files:
>
>   src/usr.bin/vmstat: vmstat.1
>
> Log Message:
>
> Describe what happens when you run vmstat witout any options aka the first 
> line
> of vmstat.

  +If
  +.Nm
  +is invoked without any options, it displays the summary of statistics since
  +boot and exits.

That's not true for the process and memory info though, right?  For
those two these are their current state, not a summary since boot.  Also
technically a few options don't change this behaviour either (at least
-M -N -v and -W?).

Not sure how we should document all this and be correct at the same
time. :)

Cheers,
Simon.


Re: CVS commit: src/usr.bin/vmstat

2016-03-07 Thread Martin Husemann
On Sun, Mar 06, 2016 at 01:01:28PM -0500, Christos Zoulas wrote:
> Module Name:  src
> Committed By: christos
> Date: Sun Mar  6 18:01:28 UTC 2016
> 
> Modified Files:
>   src/usr.bin/vmstat: Makefile
> 
> Log Message:
> Work around gcc on sparc64 bug

This warning should in general be made non-fatal, as it only tells us something
about the compiler backend, not the code being compiled.

Martin