From eugenea@infospace.com  Wed Feb 21 15:21:51 2001
Return-Path: <eugenea@infospace.com>
Received: from jack.go2net.com (jack.go2net.com [64.50.65.20])
	by hub.freebsd.org (Postfix) with SMTP id 169E037B401
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 21 Feb 2001 15:21:51 -0800 (PST)
	(envelope-from eugenea@infospace.com)
Received: (qmail 37715 invoked from network); 21 Feb 2001 23:25:49 -0000
Received: from ketel.go2net.com (10.200.10.75)
  by jack.go2net.com with SMTP; 21 Feb 2001 23:25:49 -0000
Received: (qmail 5723 invoked from network); 21 Feb 2001 23:21:50 -0000
Received: from hunches.go2net.com (HELO infospace.com) (@[10.225.33.32]) (envelope-sender <eugenea@infospace.com>)
          by ketel.go2net.com (qmail-ldap-1.03) with SMTP
          for <FreeBSD-gnats-submit@freebsd.org>; 21 Feb 2001 23:21:50 -0000
Message-Id: <3A944D8E.866BB02C@infospace.com>
Date: Wed, 21 Feb 2001 15:21:50 -0800
From: Eugene Aleynikov <eugenea@infospace.com>
Sender: eugenea@FreeBSD.ORG
Reply-To: eugene@infospace.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: vmstat bug

>Number:         25267
>Category:       bin
>Synopsis:       vmstat displays some parameters incorrectly
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Feb 21 15:30:01 PST 2001
>Closed-Date:    Tue Jun 12 12:47:55 PDT 2001
>Last-Modified:  Tue Jun 12 12:48:38 PDT 2001
>Originator:     Eugene Aleynikov
>Release:        FreeBSD 4.2-RELEASE i386
>Organization:
Go2net
>Environment:

     4.2-RELEASE

>Description:

 vmstat displays avm and fre alltogether:
    # vmstat
 procs      memory     page                    disks     faults      cpu
 r b w     avm   fre  flt  re  pi  po  fr  sr da0 da1   in   sy  cs us
sy id
 0 0 0    5404197860    1   0   0   0   1   0   0   0  152   10   3  0 
0 100

this makes some monitoring programs go crazy

>How-To-Repeat:

  type vmstat in a command prompt, look at the output

>Fix:

possible fix is:
*** vmstat.c.orig       Thu Feb 15 14:58:46 2001
--- vmstat.c    Thu Feb 15 15:00:42 2001
***************
*** 482,488 ****
                    total.t_rq - 1, total.t_dw + total.t_pw,
total.t_sw);
  #define pgtok(a) ((a) * sum.v_page_size >> 10)
  #define       rate(x) (((x) + halfuptime) / uptime)   /* round */
!               (void)printf("%8ld%6ld ",
                    (long)pgtok(total.t_avm),
(long)pgtok(total.t_free));
                (void)printf("%4lu ",
                    (u_long)rate(sum.v_vm_faults - osum.v_vm_faults));
--- 482,488 ----
                    total.t_rq - 1, total.t_dw + total.t_pw,
total.t_sw);
  #define pgtok(a) ((a) * sum.v_page_size >> 10)
  #define       rate(x) (((x) + halfuptime) / uptime)   /* round */
!               (void)printf("%8ld %6ld ",
                    (long)pgtok(total.t_avm),
(long)pgtok(total.t_free));
                (void)printf("%4lu ",
                    (u_long)rate(sum.v_vm_faults - osum.v_vm_faults));
***************
*** 534,540 ****
        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)
                 && (dev_select[i].selected <= maxshowdevs))
--- 534,540 ----
        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)
                 && (dev_select[i].selected <= maxshowdevs))
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: schweikh 
State-Changed-When: Tue Jun 12 12:47:55 PDT 2001 
State-Changed-Why:  
Fixed in -current. Thanks, Eugene! 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=25267 
>Unformatted:
 X-send-pr-version: 3.2
 
 
