From owner-cvs-src@FreeBSD.ORG Fri Jan 18 20:42:43 2008 Return-Path: Delivered-To: cvs-src@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 674F716A46E; Fri, 18 Jan 2008 20:42:43 +0000 (UTC) (envelope-from pieter@degoeje.nl) Received: from smtp.utwente.nl (unknown [IPv6:2001:610:1908:1000:204:23ff:feb5:7e66]) by mx1.freebsd.org (Postfix) with ESMTP id C43E813C474; Fri, 18 Jan 2008 20:42:42 +0000 (UTC) (envelope-from pieter@degoeje.nl) Received: from lux.student.utwente.nl (lux.student.utwente.nl [130.89.170.81]) by smtp.utwente.nl (8.12.10/SuSE Linux 0.7) with ESMTP id m0IKgZtS009036; Fri, 18 Jan 2008 21:42:35 +0100 From: Pieter de Goeje To: cvs-src@freebsd.org Date: Fri, 18 Jan 2008 21:42:34 +0100 User-Agent: KMail/1.9.7 References: <200712130236.lBD2aCWP029948@repoman.freebsd.org> In-Reply-To: <200712130236.lBD2aCWP029948@repoman.freebsd.org> MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_68QkHGLFIWDClGk" Message-Id: <200801182142.35019.pieter@degoeje.nl> X-UTwente-MailScanner-Information: Scanned by MailScanner. Contact servicedesk@icts.utwente.nl for more information. X-UTwente-MailScanner: Found to be clean X-UTwente-MailScanner-From: pieter@degoeje.nl X-Spam-Status: No Cc: src-committers@freebsd.org, cvs-all@freebsd.org, Peter Wemm Subject: Re: cvs commit: src/usr.bin/vmstat Makefile vmstat.8 vmstat.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Jan 2008 20:42:43 -0000 --Boundary-00=_68QkHGLFIWDClGk Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Content-Disposition: inline On Thursday 13 December 2007, Peter Wemm wrote: > peter 2007-12-13 02:36:11 UTC > > FreeBSD src repository > > Modified files: > usr.bin/vmstat Makefile vmstat.8 vmstat.c > Log: > Add the -H, -h and -P flags to vmstat. -P causes per-cpu output of > user/system/idle stats. -h feeds the memory column through > humanize_number() to reduce the amount of column overflowing. -H turns > this off. -h is turned on by default if stdout is a tty. > > Revision Changes Path > 1.13 +2 -2 src/usr.bin/vmstat/Makefile > 1.37 +9 -1 src/usr.bin/vmstat/vmstat.8 > 1.99 +196 -17 src/usr.bin/vmstat/vmstat.c I noticed vmstat dumps stats from all kern.smp.maxcpus CPUs on screen when using -P. Attached patch fixes the problem. Cheers, Pieter de Goeje --Boundary-00=_68QkHGLFIWDClGk Content-Type: text/x-diff; charset="iso-8859-15"; name="vmstat.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="vmstat.patch" --- /usr/src/usr.bin/vmstat/vmstat.c 2007-12-14 02:38:20.000000000 +0100 +++ vmstat.c 2008-01-18 21:34:03.000000000 +0100 @@ -739,7 +739,7 @@ (void)printf(" faults "); if (Pflag) { for (i = 0; i < ncpus; i++) { - if (cpumask && (1ul << i)) + if (cpumask & (1ul << i)) printf("cpu%-2d ", i); } printf("\n"); @@ -976,7 +976,7 @@ /* devstats does this for cp_time */ for (i = 0; i <= maxid; i++) { - if (cpumask && (1ul << i) == 0) + if ((cpumask & (1ul << i)) == 0) continue; for (state = 0; state < CPUSTATES; ++state) { tmp = cur_cp_times[i * CPUSTATES + state]; @@ -987,7 +987,7 @@ over = 0; for (i = 0; i <= maxid; i++) { - if (cpumask && (1ul << i) == 0) + if ((cpumask & (1ul << i)) == 0) continue; total = 0; for (state = 0; state < CPUSTATES; ++state) --Boundary-00=_68QkHGLFIWDClGk--