mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-12-03 10:29:15 +00:00
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'.
This commit is contained in:
parent
dbd7e3e1cb
commit
3addba4f55
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=13758
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)clock.c 7.2 (Berkeley) 5/12/91
|
||||
* $Id: clock.c,v 1.49 1996/01/15 21:26:43 phk Exp $
|
||||
* $Id: clock.c,v 1.50 1996/01/16 06:35:40 ache Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -99,6 +99,7 @@ u_int idelayed;
|
||||
unsigned i586_ctr_rate;
|
||||
long long i586_ctr_bias;
|
||||
long long i586_last_tick;
|
||||
unsigned long i586_avg_tick;
|
||||
#endif
|
||||
u_int stat_imask = SWI_CLOCK_MASK;
|
||||
int timer0_max_count;
|
||||
|
@ -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
|
||||
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)clock.c 7.2 (Berkeley) 5/12/91
|
||||
* $Id: clock.c,v 1.49 1996/01/15 21:26:43 phk Exp $
|
||||
* $Id: clock.c,v 1.50 1996/01/16 06:35:40 ache Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -99,6 +99,7 @@ u_int idelayed;
|
||||
unsigned i586_ctr_rate;
|
||||
long long i586_ctr_bias;
|
||||
long long i586_last_tick;
|
||||
unsigned long i586_avg_tick;
|
||||
#endif
|
||||
u_int stat_imask = SWI_CLOCK_MASK;
|
||||
int timer0_max_count;
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)clock.c 7.2 (Berkeley) 5/12/91
|
||||
* $Id: clock.c,v 1.49 1996/01/15 21:26:43 phk Exp $
|
||||
* $Id: clock.c,v 1.50 1996/01/16 06:35:40 ache Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -99,6 +99,7 @@ u_int idelayed;
|
||||
unsigned i586_ctr_rate;
|
||||
long long i586_ctr_bias;
|
||||
long long i586_last_tick;
|
||||
unsigned long i586_avg_tick;
|
||||
#endif
|
||||
u_int stat_imask = SWI_CLOCK_MASK;
|
||||
int timer0_max_count;
|
||||
|
@ -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
|
||||
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)clock.c 7.2 (Berkeley) 5/12/91
|
||||
* $Id: clock.c,v 1.49 1996/01/15 21:26:43 phk Exp $
|
||||
* $Id: clock.c,v 1.50 1996/01/16 06:35:40 ache Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -99,6 +99,7 @@ u_int idelayed;
|
||||
unsigned i586_ctr_rate;
|
||||
long long i586_ctr_bias;
|
||||
long long i586_last_tick;
|
||||
unsigned long i586_avg_tick;
|
||||
#endif
|
||||
u_int stat_imask = SWI_CLOCK_MASK;
|
||||
int timer0_max_count;
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)clock.c 7.2 (Berkeley) 5/12/91
|
||||
* $Id: clock.c,v 1.49 1996/01/15 21:26:43 phk Exp $
|
||||
* $Id: clock.c,v 1.50 1996/01/16 06:35:40 ache Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -99,6 +99,7 @@ u_int idelayed;
|
||||
unsigned i586_ctr_rate;
|
||||
long long i586_ctr_bias;
|
||||
long long i586_last_tick;
|
||||
unsigned long i586_avg_tick;
|
||||
#endif
|
||||
u_int stat_imask = SWI_CLOCK_MASK;
|
||||
int timer0_max_count;
|
||||
|
Loading…
Reference in New Issue
Block a user