[CentOS] CPU usage over estimated?

Fri Jun 5 07:38:35 UTC 2009
Theo Band <theo.band at greenpeak.com>

Filipe Brandenburger wrote:
> Hi,
>
> On Thu, Jun 4, 2009 at 08:37, Theo Band <theo.band at greenpeak.com> wrote:
>   
>> When I use top, I see that running processes use 245% instead of 100%.
>> If I use gkrellm, I just see one core being used 100%.
>> There are all single threaded programs, so it's not that more cores are
>> being used.
>>     
>
> Are you sure?
>
> You can type "H" in top to show separate threads, that way it would
> show up if you have more than one thread running in one of those
> programs
Yes I'm quite sure. For instance cpuburn on two machines, the only
difference is hardware (two versus four cores). The H option does not
show more threads:

Machine a (dual core Centos5 64 bit)
  Intel(R) Core(TM)2 Duo CPU     E8400
  2.6.18-128.1.6.el5 #1 SMP Wed Apr 1 09:10:25 EDT 2009 x86_64 x86_64
x86_64 GNU/Linux

top - 09:26:00 up 62 days, 21:43,  1 user,  load average: 0.30, 0.16, 0.17
Tasks: 120 total,   3 running, 117 sleeping,   0 stopped,   0 zombie
Cpu(s): 50.0%us,  0.2%sy,  0.0%ni, 49.8%id,  0.0%wa,  0.0%hi,  0.0%si, 
0.0%st
Mem:   4050728k total,  2448800k used,  1601928k free,   405860k buffers
Swap:  3538936k total,    22172k used,  3516764k free,  1762448k cached

  PID USER      PR  NI  VIRT  RES SWAP  SHR S %CPU %MEM    TIME+  COMMAND
16916 thba      25   0  2068  988 1080  308 R 100.2  0.0   0:11.48
cpuburn-in



Machine b (quad core Centos5 64 bit)
  Intel(R) Core(TM) i7 CPU         940  @ 2.93GHz
  2.6.18-128.1.6.el5 #1 SMP Wed Apr 1 09:10:25 EDT 2009 x86_64 x86_64
x86_64 GNU/Linux

top - 09:28:24 up 25 days, 40 min,  2 users,  load average: 1.44, 1.83, 1.83
Tasks: 165 total,   3 running, 162 sleeping,   0 stopped,   0 zombie
Cpu(s): 25.1%us,  0.5%sy, 25.0%ni, 49.4%id,  0.0%wa,  0.0%hi,  0.0%si, 
0.0%st
Mem:   6097924k total,  4366540k used,  1731384k free,   152248k buffers
Swap:  4194296k total,      112k used,  4194184k free,  3322344k cached

  PID USER      PR  NI  VIRT  RES SWAP  SHR S %CPU %MEM    TIME+  COMMAND
13873 thba      25   0  2068  988 1080  308 R 243.8  0.0   0:26.97
cpuburn-in

The total cpu reported is about correct (for the second machine two jobs
ran, one cpuburn-in=25% and one other with nice15=25%). It's just the
individual process on this quad core machine that's way off.
When I build the machine a couple of months ago, I did benchmarks and
used top as well. It did show "normal" results, most of the time 100%
for a process and sometimes a little more. So I guess an update in the
mean time has changed something.

Theo