Make the dummy timecounter run at 1 MHz rather than 100kHz (noticed by bde)

fix the itimer(REAL) handling.
This commit is contained in:
Poul-Henning Kamp 1998-04-05 11:49:36 +00:00
parent d59fbbf6c8
commit bfe6c9fabf
3 changed files with 13 additions and 14 deletions

View File

@ -39,7 +39,7 @@ static volatile int print_tci = 1;
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* @(#)kern_clock.c 8.5 (Berkeley) 1/21/94 * @(#)kern_clock.c 8.5 (Berkeley) 1/21/94
* $Id: kern_clock.c,v 1.63 1998/04/04 13:25:11 phk Exp $ * $Id: kern_clock.c,v 1.64 1998/04/04 18:46:09 phk Exp $
*/ */
#include <sys/param.h> #include <sys/param.h>
@ -823,7 +823,7 @@ static struct timecounter dummy_timecounter[3] = {
0, 0,
dummy_get_timecount, dummy_get_timecount,
~0, ~0,
100000, 1000000,
"dummy" "dummy"
} }
}; };

View File

@ -39,7 +39,7 @@ static volatile int print_tci = 1;
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* @(#)kern_clock.c 8.5 (Berkeley) 1/21/94 * @(#)kern_clock.c 8.5 (Berkeley) 1/21/94
* $Id: kern_clock.c,v 1.63 1998/04/04 13:25:11 phk Exp $ * $Id: kern_clock.c,v 1.64 1998/04/04 18:46:09 phk Exp $
*/ */
#include <sys/param.h> #include <sys/param.h>
@ -823,7 +823,7 @@ static struct timecounter dummy_timecounter[3] = {
0, 0,
dummy_get_timecount, dummy_get_timecount,
~0, ~0,
100000, 1000000,
"dummy" "dummy"
} }
}; };

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* @(#)kern_time.c 8.1 (Berkeley) 6/10/93 * @(#)kern_time.c 8.1 (Berkeley) 6/10/93
* $Id: kern_time.c,v 1.48 1998/04/05 10:28:01 phk Exp $ * $Id: kern_time.c,v 1.49 1998/04/05 11:17:19 peter Exp $
*/ */
#include <sys/param.h> #include <sys/param.h>
@ -102,10 +102,6 @@ settime(tv)
ts.tv_nsec = tv->tv_usec * 1000; ts.tv_nsec = tv->tv_usec * 1000;
set_timecounter(&ts); set_timecounter(&ts);
(void) splsoftclock(); (void) splsoftclock();
for (p = allproc.lh_first; p != 0; p = p->p_list.le_next) {
if (timerisset(&p->p_realtimer.it_value))
timevaladd(&p->p_realtimer.it_value, &delta);
}
lease_updatetime(delta.tv_sec); lease_updatetime(delta.tv_sec);
splx(s); splx(s);
resettodr(); resettodr();
@ -479,7 +475,7 @@ getitimer(p, uap)
*/ */
aitv = p->p_realtimer; aitv = p->p_realtimer;
if (timerisset(&aitv.it_value)) { if (timerisset(&aitv.it_value)) {
getmicrotime(&ctv); getmicroruntime(&ctv);
if (timercmp(&aitv.it_value, &ctv, <)) if (timercmp(&aitv.it_value, &ctv, <))
timerclear(&aitv.it_value); timerclear(&aitv.it_value);
else else
@ -533,6 +529,8 @@ setitimer(p, uap)
if (timerisset(&aitv.it_value)) if (timerisset(&aitv.it_value))
p->p_ithandle = timeout(realitexpire, (caddr_t)p, p->p_ithandle = timeout(realitexpire, (caddr_t)p,
tvtohz(&aitv.it_value)); tvtohz(&aitv.it_value));
getmicroruntime(&ctv);
timevaladd(&aitv.it_value, &ctv);
p->p_realtimer = aitv; p->p_realtimer = aitv;
} else } else
p->p_stats->p_timer[uap->which] = aitv; p->p_stats->p_timer[uap->which] = aitv;
@ -557,7 +555,7 @@ realitexpire(arg)
void *arg; void *arg;
{ {
register struct proc *p; register struct proc *p;
struct timeval ctv; struct timeval ctv, ntv;
int s; int s;
p = (struct proc *)arg; p = (struct proc *)arg;
@ -570,11 +568,12 @@ realitexpire(arg)
s = splclock(); /* XXX: still neeeded ? */ s = splclock(); /* XXX: still neeeded ? */
timevaladd(&p->p_realtimer.it_value, timevaladd(&p->p_realtimer.it_value,
&p->p_realtimer.it_interval); &p->p_realtimer.it_interval);
getmicrotime(&ctv); getmicroruntime(&ctv);
if (timercmp(&p->p_realtimer.it_value, &ctv, >)) { if (timercmp(&p->p_realtimer.it_value, &ctv, >)) {
ntv = p->p_realtimer.it_value;
timevalsub(&ntv, &ctv);
p->p_ithandle = p->p_ithandle =
timeout(realitexpire, (caddr_t)p, timeout(realitexpire, (caddr_t)p, tvtohz(&ntv));
hzto(&p->p_realtimer.it_value) - 1);
splx(s); splx(s);
return; return;
} }