Gentoo Archives: gentoo-user

From: Alan McKinnon <alan@××××××××××××××××.za>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] 100% CPU usage with no processes to blame?
Date: Thu, 15 Feb 2007 07:46:04
Message-Id: 200702150935.21096.alan@linuxholdings.co.za
In Reply to: Re: [gentoo-user] 100% CPU usage with no processes to blame? by brullo nulla
1 On Wednesday 14 February 2007, brullo nulla wrote:
2 > > Most likely you only looked at user cpu % and neglected to list the
3 > > system and niced times as well.
4 > >
5 > > p.s. golden rule: ps lies. top lies. free lies.
6 > > Don't believe the readings they give, rather interpret them in
7 > > context.
8 >
9 > sob. it's not the first time I hear this. What should I believe to
10 > really know my system state?
11
12 You should use ps, top and free of course! Just realize that they lie...
13
14 Actually they don't lie, they give an average. You also need to
15 understand what is going on. Without getting into the details of
16 exactly what a cpu is doing, it's performing actions millions of times
17 a second. In the time it takes top to update (2 seconds), the kernel
18 could have started and shut down several thousand forked processes. So
19 trying to measure something that changes so fast is a waste of time.
20
21 Also, there's the kernels internal timer. It's set by default to 100Hz,
22 which means that the kernel updates it's own counters 100 times a
23 second. It's quite possible to use and discard lots of memory in that
24 gap and for it to never even show up in the kernel's counters. Raising
25 the timer frequency for 1000Hz for a desktop gives more accurate
26 results, but they are still just an average.
27
28 Same with memory - the kernel allocates it out and shares the same
29 memory between several processes as it sees fit. And does what it wants
30 to with swap as well. Again, trying to find out the current state of
31 the system is useless as by the time you read it, it has changed 16
32 million times....
33
34 When we say that top lies, we really mean that it is giving you an
35 average over a looooooong period of cpu time, and you should interpret
36 it as such. It's a trend, not an instant value.
37
38 alan
39
40
41
42 --
43 Optimists say the glass is half full,
44 Pessimists say the glass is half empty,
45 Developers say wtf is the glass twice as big as it needs to be?
46
47 Alan McKinnon
48 alan at linuxholdings dot co dot za
49 +27 82, double three seven, one nine three five
50 --
51 gentoo-user@g.o mailing list

Replies

Subject Author
Re: [gentoo-user] 100% CPU usage with no processes to blame? Michael Crute <mcrute@×××××.com>
Re: [gentoo-user] 100% CPU usage with no processes to blame? Grant <emailgrant@×××××.com>