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>
This commit is contained in:
Kenneth D. Merry 1999-02-10 00:46:27 +00:00
parent 0f1eaab82c
commit 4faf42f3ae
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=43822
2 changed files with 10 additions and 13 deletions

View File

@ -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:

View File

@ -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)