From owner-freebsd-bugs Wed Mar 10 2: 5:21 1999 Delivered-To: freebsd-bugs@freebsd.org Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.26.10.9]) by hub.freebsd.org (Postfix) with ESMTP id 60F8A150A6 for ; Wed, 10 Mar 1999 02:05:05 -0800 (PST) (envelope-from bde@godzilla.zeta.org.au) Received: (from bde@localhost) by godzilla.zeta.org.au (8.8.7/8.8.7) id VAA07700; Wed, 10 Mar 1999 21:04:39 +1100 Date: Wed, 10 Mar 1999 21:04:39 +1100 From: Bruce Evans Message-Id: <199903101004.VAA07700@godzilla.zeta.org.au> To: amagai@nue.org, freebsd-bugs@FreeBSD.ORG Subject: Re: kern/10402: times(3) non-decreaseness broken in 4.0 Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org > ================================================================ > 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