Operating System - Linux
1829456 Members
1701 Online
109992 Solutions
New Discussion

Re: top and sar gives diff CPU idle time

 
skt_skt
Honored Contributor

top and sar gives diff CPU idle time



Linux hostname 2.6.9-42.ELsmp #1 SMP Wed Jul 12 23:27:17 EDT 2006 i686 i686 i386 GNU/Linux

Red Hat Enterprise Linux AS release 4 (Nahant Update 4)

top - 11:15:13 up 137 days, 20:12, 4 users, load average: 0.00, 0.02, 0.00
Tasks: 219 total, 1 running, 218 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.6% us, 0.3% sy, 0.0% ni, 99.1% id, 0.0% wa, 0.0% hi, 0.0% si
Mem: 8309660k total, 6676488k used, 1633172k free, 291896k buffers
Swap: 8257520k total, 160k used, 8257360k free, 5370644k cached

# sar 3 3
Linux 2.6.9-42.ELsmp (adela99p.noa.alcoa.com) 01/31/2008

11:14:12 AM CPU %user %nice %system %iowait %idle
11:14:15 AM all 50.00 0.00 50.00 0.00 0.00
11:14:18 AM all 50.00 0.00 50.00 0.00 0.00
11:14:21 AM all 25.00 0.00 25.00 50.00 0.00
Average: all 33.33 0.00 33.33 33.33 0.00


Looks like the opc moniotirng script uses the sar commands and it reports almost 0% idle.

# /opt/OV/bin/OpC/utils/opclxcputil 1 10
CPU states: %user %system %nice %idle
66 33 0 0
66 33 0 0
100 0 0 0
50 50 0 0
50 50 0 0
50 50 0 0
66 33 0 0
80 20 0 0
75 25 0 0
50 50 0 0
Average: 65 34 0 0

is that a bug? I have a similar system with same kernel/patch level where sar & top gives the right/same value.
2 REPLIES 2
skt_skt
Honored Contributor

Re: top and sar gives diff CPU idle time

# sar -P ALL|grep Average
Average: all 20.48 0.00 21.74 57.78 0.00
Average: 0 0.88 0.00 0.58 1.18 97.37
Average: 1 0.33 0.00 0.46 1.22 97.98
Average: 2 0.14 0.00 0.29 1.16 98.41
Average: 3 0.17 0.00 0.29 0.74 98.80


Indiviudal CPUs(0-3) shows more than 90% ide. But when it come to add all of them the values are changing..
Steven E. Protter
Exalted Contributor

Re: top and sar gives diff CPU idle time

Shalom,

known problem.

They collect data differently, always have, always have given different results.

Just gotta live with it. This isn't even a bug.

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