Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

After using top for long time, albeit basically, I have grown to distrust its % CPU column reports. I have an 8-core (quad core Intel i7 920 with hyperthreading) hardware, and see some wild numbers when running a process that should not use more than 5% overall. top happily reports 50%, and I suspect it is not so.

My question is, is it a known fact that it's inaccurate when several CPUs/cores are present?

I used mpstat from the sysstat package, and its showings are much more conservative, certainly within my expectations. I did press 1 for top to switch it to show all the core and us/sy/io stats, but the numbers are substantially higher than with mpstat...

I know that my expectations could be unfounded as well, but my gut feeling tells me top is wrong!

The reason I need to know is because the process I am monitoring only guarantees quality of service with CPU usage "less than 80%" (however vague that sounds), and I need to know how much headroom I have left. It's a streaming server.

share|improve this question
    
What CPU usage number in top do you talk about? Single or SMP mode? – Benjamin Bannier May 1 '10 at 21:58
    
Both single and SMP report a total that is about twice as high as numbers reported by mpstat. – amn May 2 '10 at 23:14
    
Try to install htop. That is is a better version (in my opinion) of top. See what results you get there first. – Waxhead Dec 11 '11 at 22:53

Actually you can run top in interactive mode by pressing 'I' and it normalizes the %CPU time by dividing by the total number of CPUs.

share|improve this answer

My guess is that a full load on your system would be 800% (100% for each core)

share|improve this answer
    
Well, isn't 800% a mathematical impossibility or something :-) That's sort of what it boils down to - wouldn't it be better for 'top' to adjust its reports so that 100% is 100% of the entire CPU array usage space? So, currently, my 50% reported have to be divided by 8 to get a more meaningful number, right? – amn May 2 '10 at 11:23
    
Although 800% seems silly, it makes it obvious that multiple cores are being used. I think it's a reasonable kludge when you don't have a distinct list of CPU utilization per core. Scaling the measurement to be within 100% wouldn't tell the user if a process was multi-core or not. – Neil May 12 '11 at 16:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .