Subject: Re: time broken on current kernel
To: <>
From: David Laight <david@l8s.co.uk>
List: current-users
Date: 03/14/2003 16:12:03
On Fri, Mar 14, 2003 at 03:51:43PM +0000, Richard Earnshaw wrote:
>
> This is with a kernel from yesterday and a userland from the end of
> January...
>
> Running time on a bootstrap of gcc on my shark now prints
>
> real 31535.90
> user 634391.-58906
> sys 1077544.-49263
>
> The real time is correct, but the other two are complete garbage.
>
> What's up?
I suppose it could be related to me fixing the child times reported.
The old code did get it wrong!
try:
$ sh -c '/bin/echo;ps -Octime -p $$'
on a fast(ish) system, note that CTIMEs < 1 tick are generated.
Ahh...
Is that a bug I spotted looking at the code in calcru - but didn't fix!
It does:
sec = p->p_rtime.tv_sec;
usec = p->p_rtime.tv_usec;
st = p->p_sticks;
ut = p->p_uticks;
it = p->p_iticks;
tot = st + ut + it;
u = (u_quad_t) sec * 1000000 + usec;
st = (u * st) / tot;
sp->tv_sec = st / 1000000;
sp->tv_usec = st % 1000000;
Now if real is 2^16, 'sec' is probably also 2^16,
so u = 2^16 * 2^20 = 2^36
tot ~= sec * stathz = 2^16 * 2^7 = 2^23 (for 128Hz statclok)
so u * st = 2^36 * 2^23 = 2^59
Getting all very close to 2^64...
David
--
David Laight: david@l8s.co.uk