aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/vmstat
diff options
context:
space:
mode:
authorKenneth D. Merry <ken@FreeBSD.org>1999-02-10 00:46:27 +0000
committerKenneth D. Merry <ken@FreeBSD.org>1999-02-10 00:46:27 +0000
commit4faf42f3ae1a331ce2e108f88c78a2902bea99cc (patch)
treec4a40115729fc095bf17c39704455d99b807f14b /usr.bin/vmstat
parent0f1eaab82c8830bfcd1190150ebe4c000a0fc568 (diff)
downloadsrc-4faf42f3ae1a331ce2e108f88c78a2902bea99cc.tar.gz
src-4faf42f3ae1a331ce2e108f88c78a2902bea99cc.zip
Fix vmstat display problems. The header printout wasn't quite right, and
the display wrapped around. This decreases the default maximum number of disks shown to 2, so things don't wrap around so easily. Also, it fixes the header display issues. Submitted by: Bruce Evans <bde@FreeBSD.ORG>
Notes
Notes: svn path=/head/; revision=43822
Diffstat (limited to 'usr.bin/vmstat')
-rw-r--r--usr.bin/vmstat/vmstat.84
-rw-r--r--usr.bin/vmstat/vmstat.c19
2 files changed, 10 insertions, 13 deletions
diff --git a/usr.bin/vmstat/vmstat.8 b/usr.bin/vmstat/vmstat.8
index 6c06202029f0..7b58608078de 100644
--- a/usr.bin/vmstat/vmstat.8
+++ b/usr.bin/vmstat/vmstat.8
@@ -30,7 +30,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)vmstat.8 8.1 (Berkeley) 6/6/93
-.\" $Id: vmstat.8,v 1.9 1997/08/25 06:40:05 charnier Exp $
+.\" $Id: vmstat.8,v 1.10 1998/09/15 08:16:43 gibbs Exp $
.\"
.Dd June 6, 1996
.Dt VMSTAT 8
@@ -89,7 +89,7 @@ instead of the default
Report on the usage of kernel dynamic memory listed first by size of
allocation and then by type of usage.
.It Fl n
-Change the maximum number of disks to display from the default of 3.
+Change the maximum number of disks to display from the default of 2.
.It Fl p
Specify which types of devices to display. There are three different
categories of devices:
diff --git a/usr.bin/vmstat/vmstat.c b/usr.bin/vmstat/vmstat.c
index 067d6d7d3fa0..d2b77b50f824 100644
--- a/usr.bin/vmstat/vmstat.c
+++ b/usr.bin/vmstat/vmstat.c
@@ -189,7 +189,7 @@ main(argc, argv)
memf = nlistf = NULL;
interval = reps = todo = 0;
- maxshowdevs = 3;
+ maxshowdevs = 2;
while ((c = getopt(argc, argv, "c:fiM:mN:n:p:stw:")) != -1) {
switch (c) {
case 'c':
@@ -539,18 +539,15 @@ dovmstat(interval, reps)
void
printhdr()
{
- register int i;
+ int i, num_shown;
+ num_shown = (num_selected < maxshowdevs) ? num_selected : maxshowdevs;
(void)printf(" procs memory page%*s", 19, "");
- if (num_selected > 1)
- (void)printf("disks %*s faults cpu\n",
- ((num_selected < maxshowdevs) ? num_selected :
- maxshowdevs ) * 4 - 7, "");
- else if (num_selected == 1)
- (void)printf("disk faults cpu\n");
- else
- (void)printf("%*s faults cpu\n", num_selected * 4, "");
-
+ if (num_shown > 1)
+ (void)printf(" disks %*s", num_shown * 4 - 7, "");
+ else if (num_shown == 1)
+ (void)printf("disk");
+ (void)printf(" faults cpu\n");
(void)printf(" r b w avm fre flt re pi po fr sr ");
for (i = 0; i < num_devices; i++)
if ((dev_select[i].selected)