Subject: bin/2944: vmstat prints bogues numbers
To: None <gnats-bugs@gnats.netbsd.org>
From: Lennart Augustsson <augustss@cs.chalmers.se>
List: netbsd-bugs
Date: 11/15/1996 22:46:40
>Number: 2944
>Category: bin
>Synopsis: vmstat prints bogues numbers
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: bin-bug-people (Utility Bug People)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Nov 15 13:50:01 1996
>Last-Modified:
>Originator: Lennart Augustsson
>Organization:
Department of Computing Science, Chalmers University
>Release: NetBSD-current 96-11-14
>Environment:
System: NetBSD calvin.cs.chalmers.se 1.2B NetBSD 1.2B (CALVIN) #5: Sat Nov 9 23:40:49 MET 1996 augustss@calvin.cs.chalmers.se:/usr/src/sys/arch/i386/compile/CALVIN i386
>Description:
Many of the fields printed by the command `vmstat 1' prints
a 1 when it should be a 0.
The active virtual memory is also way too high.
>How-To-Repeat:
Try `vmstat 1' on an inactive system.
>Fix:
The rate macro uses halfuptime and uptime to round the values,
but when uptime==1 this gets to be wrong.
The fix is easy, and included below.
I have no idea how the kernel computes the active virtual memory,
but it sure looks strange to me. It claims I have 4 GB of
active memory on this machine. Not bad :-)
I've no clue how to fix it.
*** /usr/src/usr.bin/vmstat/vmstat.c.orig Fri Nov 15 22:17:02 1996
--- /usr/src/usr.bin/vmstat/vmstat.c Fri Nov 15 22:17:09 1996
***************
*** 436,442 ****
* We round upward to avoid losing low-frequency events
* (i.e., >= 1 per interval but < 1 per second).
*/
! halfuptime = (uptime + 1) / 2;
(void)sleep(interval);
}
}
--- 436,442 ----
* We round upward to avoid losing low-frequency events
* (i.e., >= 1 per interval but < 1 per second).
*/
! halfuptime = uptime == 1 ? 0 : (uptime + 1) / 2;
(void)sleep(interval);
}
}
>Audit-Trail:
>Unformatted: