Subject: Re: Odd top behavior with current, smp sparc 20
To: Christos Zoulas <christos@astron.com>
From: Bruce O'Neel <edoneel@sdf.lonestar.org>
List: port-sparc
Date: 11/11/2005 12:49:57
Hi,

Ah, I'll check this tonight.  I had been keeping the system more
heavily loaded and hadn't seen the problem before.

Thanks!

cheers

bruce

On Thu, Nov 10, 2005 at 08:56:33PM +0000, David Laight wrote:
> 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

-- 
edoneel@sdf.lonestar.org
SDF Public Access UNIX System - http://sdf.lonestar.org