On Wednesday 14 February 2007, brullo nulla wrote:
> > Most likely you only looked at user cpu % and neglected to list the
> > system and niced times as well.
> >
> > p.s. golden rule: ps lies. top lies. free lies.
> > Don't believe the readings they give, rather interpret them in
> > context.
>
> sob. it's not the first time I hear this. What should I believe to
> really know my system state?

You should use ps, top and free of course! Just realize that they lie...

Actually they don't lie, they give an average. You also need to 
understand what is going on. Without getting into the details of 
exactly what a cpu is doing, it's performing actions millions of times 
a second. In the time it takes top to update (2 seconds), the kernel 
could have started and shut down several thousand forked processes. So 
trying to measure something that changes so fast is a waste of time.

Also, there's the kernels internal timer. It's set by default to 100Hz, 
which means that the kernel updates it's own counters 100 times a 
second. It's quite possible to use and discard lots of memory in that 
gap and for it to never even show up in the kernel's counters. Raising 
the timer frequency for 1000Hz for a desktop gives more accurate 
results, but they are still just an average.

Same with memory - the kernel allocates it out and shares the same 
memory between several processes as it sees fit. And does what it wants 
to with swap as well. Again, trying to find out the current state of 
the system is useless as by the time you read it, it has changed 16 
million times....

When we say that top lies, we really mean that it is giving you an 
average over a looooooong period of cpu time, and you should interpret 
it as such. It's a trend, not an instant value.

alan



-- 
Optimists say the glass is half full,
Pessimists say the glass is half empty,
Developers say wtf is the glass twice as big as it needs to be?

Alan McKinnon
alan at linuxholdings dot co dot za
+27 82, double three seven, one nine three five
-- 
gentoo-user@gentoo.org mailing list

Reply via email to