Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email email@example.com
From: Paul de Weerd (weerdweirdnet.nl)
Date: Thu Aug 23 2007 - 08:27:36 CDT
On Thu, Aug 23, 2007 at 02:27:48PM +0200, Paul de Weerd wrote:
| It appears that the two machines I tried this on are not sufficiently
| diverse to prove the bug is in (systat) iostat. Accidentially, these
| two machines are both dual-core. A third machine (Apple MacBook Pro)
| has the problem when run with bsd.mp, but not with bsd. My sparc64
| (single processor) doesn't have the problem either.
| Now I'm officialy completely lost.
Maybe not as much. Looking at the code, I see that etime is divided by
ncpu in /usr/src/usr.bin/systat/vmstat.c but not in
/usr/src/usr.bin/systat/iostat.c. That makes the math between vmstat.c
and iostat.c different, (by a factor of NCPU, which is 2 in the cases
where I had this problem) and explains the difference in results.
I'm now testing the attached patch which seems to work fine. Probably
obvious from the changes, I'm quite new to this stuff so I'm not
attaching a patch for iostat(8) yet. I'll prefer to get flamed for
this first ;)
Comments ? Flames ?
Paul 'WEiRD' de Weerd
RCS file: /cvs/src/usr.bin/systat/iostat.c,v
retrieving revision 1.28
diff -u -r1.28 iostat.c
--- iostat.c 30 May 2007 05:20:58 -0000 1.28
+++ iostat.c 23 Aug 2007 13:25:23 -0000
#define NFMT "%-8.8s %14.0f %14.0f %10.0f %10.0f %10.1f"
#define SFMT "%-8.8s %14s %14s %10s %10s %10s"
+static int ncpu = 1;
+ int mib, i;
+ size_t size;
+ mib = CTL_HW;
+ mib = HW_NCPU;
+ size = sizeof(ncpu);
+ if (sysctl(mib, 2, &ncpu, &size, NULL, 0) < 0)
+ return (-1);
etime = 1.0;
etime /= (float) hz;
+ etime /= (float) ncpu;
if (last.dk_ndrive != cur.dk_ndrive)