Date: Thu, 31 Jul 2003 18:31:58 +0100 From: Bruce M Simpson <bms@spc.org> To: Andrew Kinney <andykinney@advantagecom.net> Cc: freebsd-hackers@freebsd.org Subject: Re: vmstat counter "bug" Message-ID: <20030731173158.GC24526@spc.org> In-Reply-To: <3F28E6A4.22314.2255664F@localhost> References: <3F28E6A4.22314.2255664F@localhost>
next in thread | previous in thread | raw e-mail | index | archive | help
--KDt/GgjP6HVcx58l Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi Andrew, On Thu, Jul 31, 2003 at 09:51:32AM -0700, Andrew Kinney wrote: > I'm sure this is probably just a limitation of the variable type used, > but when we run a 'vmstat -m' on our 4.8-RELEASE machine, we > get a negative integer on the "Requests" section of the memory > totals. The field you refer to does not exist under -CURRENT's vmstat(8) command. However, the attached patch should work for you. The bug is caused by a signed integer and printf format being used for the statistic in question, totreq. This is just a running total of what the vmstat(8) command is able to learn from vm_meter.c's exported sysctls. This is a fairly quick patch but you'll need to apply it from within /usr/src/usr.bin/vmstat, then run a make obj/make/make install. I've raised a PR on your behalf with the patch enclosed, it should reach GNATS any second. BMS --KDt/GgjP6HVcx58l Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="vmstat_totreq.patch" --- vmstat.c.orig Thu Jul 31 18:26:36 2003 +++ vmstat.c Thu Jul 31 18:27:00 2003 @@ -758,7 +758,8 @@ register struct malloc_type *ks; register int i, j; int len, size, first, nkms; - long totuse = 0, totfree = 0, totreq = 0; + long totuse = 0, totfree = 0; + unsigned long totreq = 0; const char *name; struct malloc_type kmemstats[MAX_KMSTATS], *kmsp; char buf[1024]; @@ -862,7 +863,7 @@ totreq += ks->ks_calls; } (void)printf("\nMemory Totals: In Use Free Requests\n"); - (void)printf(" %7ldK %6ldK %8ld\n", + (void)printf(" %7ldK %6ldK %8lu\n", (totuse + 1023) / 1024, (totfree + 1023) / 1024, totreq); } --KDt/GgjP6HVcx58l--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030731173158.GC24526>