Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

In my CentOS server, when I check the resources with sar command, user cpu usage is around %15 while in top command the sole 'java' process uses like %99 of cpu. sometimes it's even goes further than %100! who's lying here?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Neither -- they're just giving a different idea of CPU usage.

Top's idea of CPU is "per-core" -- that is, "this program is using 100% of one core". A multithreaded program can, therefore, be using, say, "400% CPU" -- which makes the eyes water a little sometimes.

On the other hand, sar sees it as as a percentage of total CPU -- so on a 4 core system, one fully utilised CPU core will show as "25% CPU", and the 400%-using program will show as 100%.

There's also the issue of instantaneous vs long-term averages, but I'm going to assume that you've accounted for that.

share|improve this answer
    
Thanks for the answer buddy, that was my guess too. I actually have considered long-term averages and the interval was set to 1 sec. –  SJ.Jafari Aug 15 '11 at 15:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.