Operating System - HP-UX
1826160 Members
4575 Online
109691 Solutions
New Discussion

sar %idle different from top %idle

 
kenny chia
Regular Advisor

sar %idle different from top %idle

I ran both commands on the same server at the same time(on 2 telnet sessions). I noticed that the %idle figures reported by sar and top are different (5%+ vs 80%). What could be the cause??

# sar 5 30
13:33:40 %usr %sys %wio %idle
13:33:45 6 11 74 10
13:33:50 9 13 71 6
13:33:55 6 12 78 4
13:34:00 10 14 71 5
13:34:05 10 11 74 5
13:34:10 10 11 72 7
13:34:15 9 13 72 6
13:34:20 5 11 78 7
13:34:25 6 8 77 9

# top
Load averages: 1.11, 1.19, 1.24
179 processes: 178 sleeping, 1 running
Cpu states:
CPU LOAD USER NICE SYS IDLE BLOCK SWAIT INTR SSYS
0 1.23 5.2% 0.0% 13.3% 81.4% 0.0% 0.0% 0.0% 0.0%
1 1.00 6.8% 0.0% 4.1% 89.2% 0.0% 0.0% 0.0% 0.0%
--- ---- ----- ----- ----- ----- ----- ----- ----- -----
avg 1.11 6.0% 0.0% 8.7% 85.3% 0.0% 0.0% 0.0% 0.0%

Memory: 32572K (5612K) real, 64524K (23192K) virtual, 17008K free Page# 1/6

CPU TTY PID USERNAME PRI NI SIZE RES STATE TIME %WCPU %CPU COMMAND
1 rroot 649 adampro 185 20 7404K 360K run 189:18 7.87 7.86 oracle01
0 rroot 998 root 154 10 312K 268K sleep 6409:10 7.77 7.76 diagmond
1 rroot 28144 adampro 148 20 7404K 364K sleep 187:30 7.70 7.68 oracle01
0 rroot 76 root 100 20 0K 0K sleep 670:50 1.00 1.00 netisr
1 pty/ttyp2 24637 root 178 20 644K 372K run 0:00 0.51 0.51 top
1 rroot 366 root 154 20 32K 24K sleep 195:42 0.31 0.31 syncer

All Your Bases Are Belong To Us!
2 REPLIES 2
Hoefnix
Honored Contributor

Re: sar %idle different from top %idle

I think the difference is the
%wio:idle with some process waiting for I/O (only block I/O, raw I/O, or VM pageins/swapins indicated);

Take the sum of %idle and %wio and it's about the 80% you are looking for.

Regards,
Peter

Steven E. Protter
Exalted Contributor

Re: sar %idle different from top %idle

Kenny,

sar and top calculate things differently. I will say that sar is more useful.

I'm attaching a sar script that might interest you in this area.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com