Date: Wed, 10 Mar 1999 21:04:39 +1100 From: Bruce Evans <bde@zeta.org.au> To: amagai@nue.org, freebsd-bugs@FreeBSD.ORG Subject: Re: kern/10402: times(3) non-decreaseness broken in 4.0 Message-ID: <199903101004.VAA07700@godzilla.zeta.org.au>
next in thread | raw e-mail | index | archive | help
> ================================================================ > problem: I make a trace of a funcion calcru in /usr/src/sys/kern/kern_resources.c > > p->p_sticks p->p_uticks p->p_iticks totusec(adjusted) > a call : 76 13 37 928620 > next call: 76 13 38 928793 > > utime and stime (in micro second) are evaluated as follows: > > utime = (totusec * p->p_uticks) / (p->p_sticks + p->p_uticks + p->p_iticks); > stime = (totusec * p->p_sticks) / (p->p_sticks + p->p_uticks + p->p_iticks); > > p->p_sticks p->p_uticks p->p_iticks totusec utime+stime > a call : 76 13 37 928620 655930 > next call: 76 13 38 928793 650886 > decrease 5044 usec This is correct. The problem is most obvious for small tick counts. E.g.: a call : 0 1 0 N 0 next call: 1 1 0 (N+eps)/2 (N+eps)/2 > fix: > May be difficult.... Record the times returned by calcru() and adjust them on each call to ensure monotonicity. The adjustment is always possible because totusec is monotonic. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199903101004.VAA07700>