From owner-freebsd-current Wed Nov 1 09:32:12 1995 Return-Path: owner-current Received: (from root@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id JAA22873 for current-outgoing; Wed, 1 Nov 1995 09:32:12 -0800 Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.19]) by freefall.freebsd.org (8.6.12/8.6.6) with ESMTP id JAA22867 for ; Wed, 1 Nov 1995 09:32:07 -0800 Received: (from bde@localhost) by godzilla.zeta.org.au (8.6.9/8.6.9) id EAA07621; Thu, 2 Nov 1995 04:30:41 +1100 Date: Thu, 2 Nov 1995 04:30:41 +1100 From: Bruce Evans Message-Id: <199511011730.EAA07621@godzilla.zeta.org.au> To: bde@zeta.org.au, jhay@mikom.csir.co.za Subject: Re: Time problems Cc: current@FreeBSD.org, wollman@lcs.mit.edu Sender: owner-current@FreeBSD.org Precedence: bulk >OK, I did that and the 10 second delay takes about 8.5 seconds and the 100 >second delay takes about 88 seconds. Here is the first part of dmesg: Urk. >Now how do I go further to find out where my problem is? Perhaps the 8254 clock is being accessed too fast. Try adding some delays before each inb() and outb() in clock.c:getit(). Count to 100 or so to get at least 1 usec delay. If pentium_mhz is set to 0, then microtime() uses essentially the same method as DELAY(). It accesses the clock registers as fast as possible. Errors as large as 15 in 100 might be noticeable if you run the following program. You will have to adjust the constants 25 and 50 (perhaps to 0 and 100) to filter out the uninteresting stuff. Differences of < 0 or much less than the average value mean that there is a problem. The program should calculate the average value to decide a good range to filter... --- #include #include #define SIZE 102400 struct timeval buf[SIZE]; int main(void) { int n; long s; struct timeval tv; struct timezone tz; s = gettimeofday(&tv, &tz); buf[0] = tv; printf("%ld %ld\n", buf[0].tv_sec, buf[0].tv_usec); for (n = 1; n < SIZE; ++n) { s = gettimeofday(&tv, &tz); buf[n] = tv; } for (n = 1; n < SIZE; ++n) { s = (buf[n].tv_sec - buf[n - 1].tv_sec) * 1000000 + buf[n].tv_usec - buf[n - 1].tv_usec; if (s < 25 || s > 50) printf("%d %ld\n", n, s); } return 0; } --- Bruce