From owner-freebsd-bugs Wed Feb 21 15:30:15 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 2C56237B65D for ; Wed, 21 Feb 2001 15:30:02 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f1LNU2Z54079; Wed, 21 Feb 2001 15:30:02 -0800 (PST) (envelope-from gnats) Received: from hunches.go2net.com (natbox.go2net.com [209.191.181.146]) by hub.freebsd.org (Postfix) with ESMTP id 5113037B491 for ; Wed, 21 Feb 2001 15:26:59 -0800 (PST) (envelope-from eugenea@go2net.com) Received: from eugenea by hunches.go2net.com with local-smtp (Exim 3.12 #1 (Debian)) id 14Viex-0004b9-00; Wed, 21 Feb 2001 15:26:59 -0800 Message-Id: Date: Wed, 21 Feb 2001 15:26:59 -0800 (PST) From: Yevgeniy Aleynikov To: FreeBSD-gnats-submit@freebsd.org Subject: bin/25268: vmstat bug Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 25268 >Category: bin >Synopsis: vmstat displays some parameters incorrectly >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Feb 21 15:30:01 PST 2001 >Closed-Date: >Last-Modified: >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: >Unformatted: X-send-pr-version: 3.2 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message