Index: sys/sys/time.h =================================================================== --- sys/sys/time.h (revision 242942) +++ sys/sys/time.h (working copy) @@ -58,6 +58,8 @@ struct bintime { extern int tc_timethreshold; extern struct bintime tick_bt; +#define TC_DEFAULTPERC 5 + #define FREQ2BT(freq, bt) \ { \ (bt)->sec = 0; \ Index: sys/kern/kern_tc.c =================================================================== --- sys/kern/kern_tc.c (revision 242942) +++ sys/kern/kern_tc.c (working copy) @@ -120,9 +120,10 @@ SYSCTL_INT(_kern_timecounter, OID_AUTO, stepwarnin ×tepwarnings, 0, "Log time steps"); int tc_timethreshold; +int tc_timepercentage; struct bintime tick_bt; -SYSCTL_INT(_kern, OID_AUTO, tc_timethreshold, CTLFLAG_RW, - &tc_timethreshold, 0, "Precision threshold for timing measurements"); +SYSCTL_INT(_kern, OID_AUTO, tc_timepercentage, CTLFLAG_RW, + &tc_timepercentage, 0, "Precision percentage tolerance"); static void tc_windup(void); static void cpu_tick_calibrate(int); @@ -1728,10 +1729,12 @@ inittimecounter(void *dummy) tc_tick = (hz + 500) / 1000; else tc_tick = 1; + tick_rate = hz / tc_tick; + tc_timepercentage = + (tc_timepercentage == 0) ? TC_DEFAULTPERC : tc_timepercentage; + tc_timethreshold = (100 / tc_timepercentage) * (1000000000 / tick_rate); + FREQ2BT(tick_rate, &tick_bt); p = (tc_tick * 1000000) / hz; - tc_timethreshold = 20 * imin(1000000000 / hz, 1000000); - tick_rate = imax(hz, tc_tick); - FREQ2BT(tick_rate, &tick_bt); printf("Timecounters tick every %d.%03u msec\n", p / 1000, p % 1000); #ifdef FFCLOCK