From owner-cvs-all@FreeBSD.ORG Mon Dec 8 04:14:00 2003 Return-Path: Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 737C616A4CE; Mon, 8 Dec 2003 04:14:00 -0800 (PST) Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id CBA1543FE0; Mon, 8 Dec 2003 04:13:57 -0800 (PST) (envelope-from bde@zeta.org.au) Received: from gamplex.bde.org (katana.zip.com.au [61.8.7.246]) by mailman.zeta.org.au (8.9.3p2/8.8.7) with ESMTP id XAA11434; Mon, 8 Dec 2003 23:13:54 +1100 Date: Mon, 8 Dec 2003 23:13:53 +1100 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: Marcel Moolenaar In-Reply-To: <200312080757.hB87vvTA048651@repoman.freebsd.org> Message-ID: <20031208225505.H6229@gamplex.bde.org> References: <200312080757.hB87vvTA048651@repoman.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: cvs-src@FreeBSD.org cc: src-committers@FreeBSD.org cc: cvs-all@FreeBSD.org Subject: Re: cvs commit: src/usr.bin/vmstat vmstat.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Dec 2003 12:14:00 -0000 On Sun, 7 Dec 2003, Marcel Moolenaar wrote: > marcel 2003/12/07 23:57:57 PST > > FreeBSD src repository > > Modified files: > usr.bin/vmstat vmstat.c > Log: > Unbreak vmstat -i on ia64: > o nintr and inamlen must by of type size_t, not int, > o Remove now unnecessary casts, > o Handle the aflag differently, because the intr. names have a > fixed width and almost always have trailing spaces. The fixed width and padding with spaces is a new kernel bug on i386's. Was it broken before on ia64's? It causes problems in both vmstat and systat. I don't like the aflag handling and removed most of it. Interrupts with nonzero counts should always be displayed (like they used to be), and there is little need for different levels of allness. This patch depends on other changes to print the rate more precisely. The extra precision should be an option. Always printing it saves me having to fix the rounding error for integer division to see that the clock frequency are nearer to their nominal integral values than to those values less 1. %%% Index: vmstat.c =================================================================== RCS file: /home/ncvs/src/usr.bin/vmstat/vmstat.c,v retrieving revision 1.71 diff -u -2 -r1.71 vmstat.c --- vmstat.c 8 Dec 2003 07:57:57 -0000 1.71 +++ vmstat.c 8 Dec 2003 11:38:03 -0000 @@ -868,33 +878,30 @@ } } - nintr /= sizeof(u_long); - tintrname = intrname; + nintr /= sizeof(*intrcnt); istrnamlen = strlen("interrupt"); + tintrname = intrname; for (i = 0; i < nintr; i++) { clen = strlen(tintrname); + + /* Work around bogus padding in new interrupt code. */ + while (clen > 0 && tintrname[clen - 1] == ' ') + clen--; + if (clen > istrnamlen) istrnamlen = clen; tintrname += clen + 1; } - (void)printf("%-*s %20s %10s\n", istrnamlen, "interrupt", "total", + (void)printf("%-*s %20s %13s\n", istrnamlen, "interrupt", "total", "rate"); inttotal = 0; for (i = 0; i < nintr; i++) { - const char *p; - if (intrname[0] != '\0' && - (aflag > 0 || *intrcnt != 0) && -#ifdef __ia64__ - (aflag > 1 || *intrname != '#')) -#else - (aflag > 1 || ((p = strchr(intrname, ' ')) && p[1] != ' ')) && - (aflag > 2 || strncmp(intrname, "stray ", 6) != 0)) -#endif - (void)printf("%-*s %20lu %10lu\n", istrnamlen, intrname, - *intrcnt, *intrcnt / uptime); + if (*intrcnt != 0 || aflag && *intrname != '\0') + (void)printf("%-*.*s %20lu %17.6f\n", istrnamlen, + istrnamlen, intrname, *intrcnt, *intrcnt / uptime); intrname += strlen(intrname) + 1; inttotal += *intrcnt++; } - (void)printf("%-*s %20llu %10llu\n", istrnamlen, "Total", - (long long)inttotal, (long long)(inttotal / uptime)); + (void)printf("%-*s %20ju %17.6f\n", istrnamlen, "Total", + (uintmax_t)inttotal, inttotal / uptime); } %%% Bruce