SAR vs. TOP for monitoring CPU

Posted on 2006-06-15
Last Modified: 2008-03-17

We have been monitoring the CPU usage on a system with sar and top.  top seems to give rather spurious results with the CPU idle not apparently relating to the amount of CPU taken up by processes.  See information below - one process is taking up 97% of a CPU, yet the minimum CPU idle is 12%?

Are there anythings to be aware of when reviewing CPU usage using top or sar?  Which is the most accurate?

Many thanks,


System: hwiodsp1                                      Wed Jun 14 10:07:56 2006
Load averages: 0.41, 0.49, 0.40
227 processes: 196 sleeping, 30 running, 1 zombie
Cpu states:
 0    0.32   2.6%   0.0%   0.0%  97.4%   0.0%   0.0%   0.0%   0.0%
 1    0.53  50.2%   0.0%   1.0%  48.8%   0.0%   0.0%   0.0%   0.0%
 2    0.52  87.5%   0.0%   0.8%  11.8%   0.0%   0.0%   0.0%   0.0%
 3    0.26  58.3%   0.0%   0.4%  41.3%   0.0%   0.0%   0.0%   0.0%
---   ----  -----  -----  -----  -----  -----  -----  -----  -----
avg   0.41  49.5%   0.0%   0.6%  49.9%   0.0%   0.0%   0.0%   0.0%
Memory: 2937204K (1391440K) real, 3136700K (1535900K) virtual, 2023896K free  Page# 1/7
 2   ?    17221 oracle   241 20  2241M 19132K run     49:06 96.84 96.67 oracleGIOSPROD
 3   ?    28667 oracle   241 20  2241M 19516K run      2:42 43.52 43.45 oracleGIOSPROD
 0   ?     9591 oracle   154 20  2233M 11372K sleep    0:00  4.82  2.30 oracleGIOSPROD
 0   ?     9467 oracle   154 20  2230M  8932K sleep    0:00  1.39  1.39 oracleGIOSPROD
Question by:neil_mw
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

JJSmith earned 150 total points
ID: 16914493

It's not really a competition, if one was simply better than the other - then we would only have the one!

They WILL demostrate different outputs for the same 'statistic', basically because they measure based on different parameters/algorithms. During their varient calculations, 2 instances ( sar + top ), will not be sampling 'something' concurrently due to natural contention or 'not being in sync' with each other - throw in the fact that the work of one influences the stats of the other and we are almost into chaos theory ;- )

We have to accept they will deliver differences side by side. If I was asked which is the most accurate I would plumb for sar delivering the best 'averages' providing a reasonabley sized interval ( the smaller the interval - the rougher the average ). So it's a good, free, tool for longer term monitoring.

Of course there are 'costed' tools that take all this into account and for a price will provide you with a 3rd set of figures, if run side by side ( sometime they will even discount their own impact of the measured resources ;- )

If we take a 1000th of a second as a clock tick ( really slow these days ), then there are 86,400,000 of them in a day - is the state of the server on one of these ticks really that important?

If we calculate how busy a CPU is and subtracted it from 100 then we would have the idle - but what was it busy doing sys or user, and hang on ..... did it spend any time waiting for I/O ?

If one was simply better than the other - then we would only have the one! - or I have already said that

I don't seek to confuse - but sometimes there are differences .... just because


LVL 62

Expert Comment

ID: 16968448
No system is perfect in such accounting.

uname -a from you will help with system specific interpretaion.

Author Comment

ID: 17558915
No offence to gheist, however I'll accept the lengthy answer by JJSmith.  Sorry for the delay in replying.

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (…
FreeBSD on EC2 FreeBSD ( is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question