summaryrefslogtreecommitdiffstats
path: root/sys/i386/include/clock.h
diff options
context:
space:
mode:
authorwollman <wollman@FreeBSD.org>1996-01-30 18:56:47 +0000
committerwollman <wollman@FreeBSD.org>1996-01-30 18:56:47 +0000
commit0f051dbe15584dfdb04ee0ce3c0f2e9164097280 (patch)
tree3312ba08ef0790620d22873f6f6020aeee294199 /sys/i386/include/clock.h
parent3b195d769a569c04772af6f2ca2888e3b13da1f9 (diff)
downloadFreeBSD-src-0f051dbe15584dfdb04ee0ce3c0f2e9164097280.zip
FreeBSD-src-0f051dbe15584dfdb04ee0ce3c0f2e9164097280.tar.gz
No longer use the cyclecounter to attempt to correct for late or missed
clock interrupts. Keep a 1-in-16 smoothed average of the length of each tick. If the CPU speed is correctly diagnosed, this should give experienced users enough information to figure out a more suitable value for `tick'.
Diffstat (limited to 'sys/i386/include/clock.h')
-rw-r--r--sys/i386/include/clock.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/sys/i386/include/clock.h b/sys/i386/include/clock.h
index 1f63bfe..8671311 100644
--- a/sys/i386/include/clock.h
+++ b/sys/i386/include/clock.h
@@ -3,7 +3,7 @@
* Garrett Wollman, September 1994.
* This file is in the public domain.
*
- * $Id: clock.h,v 1.7 1995/12/10 13:38:07 phk Exp $
+ * $Id: clock.h,v 1.8 1995/12/24 08:10:49 davidg Exp $
*/
#ifndef _MACHINE_CLOCK_H_
@@ -58,6 +58,7 @@ extern int disable_rtc_set;
extern unsigned i586_ctr_rate; /* fixed point */
extern long long i586_last_tick;
extern long long i586_ctr_bias;
+extern unsigned long i586_avg_tick;
#endif
extern int timer0_max_count;
extern u_int timer0_overflow_threshold;
@@ -72,17 +73,16 @@ static __inline u_long
cpu_thisticklen(u_long dflt)
{
long long old;
- long rv;
+ long len;
if (i586_ctr_rate) {
old = i586_last_tick;
I586_CYCLECTR(i586_last_tick);
- rv = ((i586_last_tick - old) << I586_CTR_RATE_SHIFT)
+ len = ((i586_last_tick - old) << I586_CTR_RATE_SHIFT)
/ i586_ctr_rate;
- } else {
- rv = dflt;
+ i586_avg_tick = i586_avg_tick * 15 / 16 + len / 16;
}
- return rv;
+ return dflt;
}
#endif
OpenPOWER on IntegriCloud