From ipfw@ya3.so-net.ne.jp  Mon Mar  5 08:36:52 2001
Return-Path: <ipfw@ya3.so-net.ne.jp>
Received: from mgate08.so-net.ne.jp (mgate08.so-net.ne.jp [210.139.254.155])
	by hub.freebsd.org (Postfix) with ESMTP id 0EAF037B719
	for <FreeBSD-gnats-submit@freebsd.org>; Mon,  5 Mar 2001 08:36:49 -0800 (PST)
	(envelope-from ipfw@ya3.so-net.ne.jp)
Received: from mail.ya3.so-net.ne.jp (mspool11.so-net.ne.jp [210.139.248.11])
	by mgate08.so-net.ne.jp (8.8.8+3.0Wbeta9/3.6W01022711) with ESMTP id BAA08749
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 6 Mar 2001 01:36:47 +0900 (JST)
Received: from localhost (pee7b3c.kngwnt01.ap.so-net.ne.jp [202.238.123.60])
	by mail.ya3.so-net.ne.jp (8.9.3/3.7W01022316) with ESMTP id BAA17102
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 6 Mar 2001 01:36:46 +0900 (JST)
Message-Id: <20010306014248K.ipfw@ya3.so-net.ne.jp>
Date: Tue, 06 Mar 2001 01:42:48 +0900
From: Yoshihiro Koya <Yoshihiro.Koya@math.yokohama-cu.ac.jp>
Sender: ipfw <ipfw@ya3.so-net.ne.jp>
To: FreeBSD-gnats-submit@freebsd.org
Subject: Incorrect output of top(1)
X-Send-Pr-Version: 3.113

>Number:         25545
>Category:       bin
>Synopsis:       Incorrect Mem value produced by top(1).
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    tmm
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Mar 05 08:40:01 PST 2001
>Closed-Date:    Tue Mar 20 08:29:46 PST 2001
>Last-Modified:  Tue Mar 20 08:32:54 PST 2001
>Originator:     Yoshihiro Koya
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
Dpet. of Math. Sci, Yokohama City University
>Environment:
System: FreeBSD current.my.domain 5.0-CURRENT FreeBSD 5.0-CURRENT #2: Mon Mar 5 20:08:25 JST 2001 root@current.my.domain:/usr/obj/usr/src/sys/current i386
>Description:
The value produced by top(1) is incorrect.
For example,

last pid:   734;  load averages:  0.13,  0.04,  0.02      up 0+00:26:37  01:32:02
33 processes:  1 running, 32 sleeping
CPU states:     % user,     % nice,     % system,     % interrupt,     % idle
Mem: 9044K Active, 8241K Inact, 5703K Wired, 15K Cache, 35M Buf, 40M Free
Swap: 256M Total, 256M Free

The output above was obtained on the machine with 256MB ram.
The sum of value "Active", "Inact", "Wired", "Chache", "Buf" and "Free"
seems to be too small.
>How-To-Repeat:
% top

and investigate its output.
>Fix:

--- machine.c.orig	Tue Mar  6 01:23:21 2001
+++ machine.c	Tue Mar  6 01:31:37 2001
@@ -330,7 +330,12 @@
 	GETSYSCTL("vm.stats.vm.v_swappgsin", nspgsin);
 	GETSYSCTL("vm.stats.vm.v_swappgsout", nspgsout);
 	/* convert memory stats to Kbytes */
+	memory_stats[0] = pagetok(memory_stats[0]);
+	memory_stats[1] = pagetok(memory_stats[1]);
+	memory_stats[2] = pagetok(memory_stats[2]);
+	memory_stats[3] = pagetok(memory_stats[3]);
 	memory_stats[4] = bufspace / 1024;
+	memory_stats[5] = pagetok(memory_stats[5]);
 	memory_stats[6] = -1;
 
 	/* first interval */
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: tmm 
State-Changed-When: Tue Mar 20 08:29:46 PST 2001 
State-Changed-Why:  
Corrected, thanks. 



Responsible-Changed-From-To: freebsd-bugs->tmm 
Responsible-Changed-By: tmm 
Responsible-Changed-When: Tue Mar 20 08:29:46 PST 2001 
Responsible-Changed-Why:  
I have done the relevant changes to top. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=25545 
>Unformatted:
