1836997 Members
2230 Online
110111 Solutions
New Discussion

glance vs. sar vs. top

 
Todd Larchuk
Advisor

glance vs. sar vs. top

I find top to be very inaccurate. I did a short test to compare glance, sar, and top. I wrote a short program to go 100% CPU for 10 seconds then sleep for 10s and repeat 2 more times.

I ran the program and looked at the GlancePlus output (I printed proc_cpu_total_util from the symptoms window ). What I see is what I expect, nearly 100% utilization for 10 seconds followed by 0% for 10 seconds.

Then I ran and looked at sar. The machine has 6 CPUs, so 100% on one CPU is 16.6% global. I see what I expect, 16% or 17% cpu for 10 seconds followed by 0% and repeating 2 more times.

Then I run top. It shows CPU utilization whether the process state is run or sleep, and the percent cpu during the run state seems to slowly creep up but not get near the 100% I expect. I have seen this behavior from top before, from which I have concluded that it performs some heavy moving averaging so that process cpu always slowly ramps up and down rather than abruptly changing like glance or sar shows.

I have attached my program and the data. My conclusion is that top can't be trusted. Am I missing something?
4 REPLIES 4
S.K. Chan
Honored Contributor

Re: glance vs. sar vs. top

Generaly speaking top has it's own use and cannot really be compared with glance. I use top if I want to get quick look at my system resource but when I want more accurate data, I turn to glance. The thing is top is designed as a "snapshot" system diagnostic tool whereas glance gets its data from the running kernel plus a runtime daemon that feeds additional data into it when it changes thus giving a more "realtime" feel for it.
Helen French
Honored Contributor

Re: glance vs. sar vs. top

There is a chance that you are missing some patches in the system, especially "top(1m)" patches. Which OS version are you running ?

It's obvious that top will not give the best outputs as like Glance does, but I don't believe that it will report something incorrect. If yes, then you need to apply the patches !
Life is a promise, fulfill it!
Todd Larchuk
Advisor

Re: glance vs. sar vs. top

OS is HPUX 11

I have seen top and glance disagree to the extent that top say 100% cpu and glance says 0%. I didn't know what to say other than I trust glance over top.

From your comment, I am assuming that top shouldn't be that much different than glance. I'll check into patches for top --- thanks
Helen French
Honored Contributor

Re: glance vs. sar vs. top

Again, I agree with you that Glance is a better tool than top.

If you mentioned OS is 11.00 - then apply the patch PHCO_26020 (s700_800 11.00 top(1) cumulative patch)

If you mentioned OS is 11.11 - then apply the patch PHCO_25204 (s700_800 11.11 top(1) cumulative patch)

Read the patch descriptions, it includes solutions for lot of bugs. One of them from the document - "top(1) displays wrong values for the average cpu time spent in each state on a multiprocessor machine."

Also I would suggest you to check the Custom Patch Manager and install all available patches to the system.
Life is a promise, fulfill it!