Subject: Re: Odd top behavior with current, smp sparc 20
To: Christos Zoulas <christos@astron.com>
From: David Laight <david@l8s.co.uk>
List: port-sparc
Date: 11/10/2005 20:56:33
On Thu, Nov 10, 2005 at 04:19:25PM +0000, Christos Zoulas wrote:
>
> Well, pp->p_rtime_sec is supposed to work but somehow in your case it doesn't.
> I cannot really explain why it does not work, since this is a copy of:
>
> p->p_rtime.tv_sec
Got it....
The scheduler remembers the time at which the process started running,
when it switches out (or goes idle) it adds that elapsed time period
to p_rtime.
In your case the processes never sleep, and only the one on cpu0 is ever
suspended to allow another process (eg top) to run.
So top (and anything else) can only report the execution time of the
last time the process stopped running.
Actually on a system with a TSC (even a broken one like the net4801)
it ought to be possible to accumulate user, kernel and interrupt
time by reading the TSC - in which case this wouldn't happen because
the values would get summed onto the process every clock interrupt.
This scheme would also solve the 'reported cpu time goes down' bugs.
Alternatively the code that returns the values (in the bowels of sysctl)
could add in the execution time of active processes before returning
the data.
David
--
David Laight: david@l8s.co.uk