summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2002-02-01 14:31:20 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2002-02-01 14:31:20 +0000
commitcc63f9c98f09bf6610a2356f4efb0e68d826014d (patch)
treee8cec461f2086bf9a11642db443e012257a58355 /usr.bin
parenta99c650a9f566cacc3deb33118e521589229a913 (diff)
Add a verbose flag. Print unused memory types when verbose.
Don't print unused pools when not verbose.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/vmstat/vmstat.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/usr.bin/vmstat/vmstat.c b/usr.bin/vmstat/vmstat.c
index feb6b5598c1..1cdd3b6bc19 100644
--- a/usr.bin/vmstat/vmstat.c
+++ b/usr.bin/vmstat/vmstat.c
@@ -1,5 +1,5 @@
/* $NetBSD: vmstat.c,v 1.29.4.1 1996/06/05 00:21:05 cgd Exp $ */
-/* $OpenBSD: vmstat.c,v 1.64 2002/01/21 17:30:38 deraadt Exp $ */
+/* $OpenBSD: vmstat.c,v 1.65 2002/02/01 14:31:19 art Exp $ */
/*
* Copyright (c) 1980, 1986, 1991, 1993
@@ -157,6 +157,8 @@ char *nlistf, *memf;
extern char *__progname;
+int verbose = 0;
+
int
main(argc, argv)
int argc;
@@ -170,7 +172,7 @@ main(argc, argv)
char errbuf[_POSIX2_LINE_MAX];
interval = reps = todo = 0;
- while ((c = getopt(argc, argv, "c:fiM:mN:stw:")) != -1) {
+ while ((c = getopt(argc, argv, "c:fiM:mN:stw:v")) != -1) {
switch (c) {
case 'c':
reps = atoi(optarg);
@@ -199,6 +201,9 @@ main(argc, argv)
case 'w':
interval = atoi(optarg);
break;
+ case 'v':
+ verbose = 1;
+ break;
case '?':
default:
usage();
@@ -932,7 +937,7 @@ domem()
for (first = 1, i = MINBUCKET, kp = &buckets[i]; i < MINBUCKET + 16;
i++, kp++) {
- if (kp->kb_calls == 0)
+ if (kp->kb_calls == 0 && !verbose)
continue;
if (first) {
(void)printf("Memory statistics by bucket size\n");
@@ -1067,6 +1072,11 @@ print_pool(struct pool *pp, char *name)
"Idle");
first = 0;
}
+
+ /* Skip unused pools unless verbose output. */
+ if (pp->pr_nget == 0 && !verbose)
+ return;
+
if (pp->pr_maxpages == UINT_MAX)
sprintf(maxp, "inf");
else