Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Dramatically reduce the CPU usage of 'top'' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Dramatically reduce the CPU usage of 'top'
Authored by: oscillik on Feb 20, '04 12:51:13PM

according to the iPulse documentation (an app that monitors system resources, cpu load, etc) a process that monitors itself is notoriously inaccurate

anyone else care to comment on that?

---
music is no longer considered an artform :(



[ Reply to This | # ]
Dramatically reduce the CPU usage of 'top'
Authored by: mpiatek on Feb 20, '04 02:02:06PM

I'm the author of another system monitor application called XRG. In the latest version, I added the ability to control-click on the CPU graph and it will show you the 5 processes using the most CPU time. I have found that more often than not, XRG will display itself as using much more CPU time than it is really using (10-15% instead of 3-4% shown by top and Activity Monitor). I believe this is caused by the code module I use to get the process CPU usage statistics. Every time the menu is activated, it takes some time to grab CPU usages and that skews the results that I get for the XRG app itself. I haven't been able to come across a way to avoid this issue, aside from spending extra CPU time always by constantly keeping an updated list of process CPU usage.

Anyway, my two cents,
Mike Piatek-Jimenez

[ Reply to This | # ]
Dramatically reduce the CPU usage of 'top'
Authored by: huzzam on Feb 20, '04 04:24:51PM

...a process that monitors itself is notoriously inaccurate

Isn't that the basis of quantum mechanics? I guess that means quantum computing is here!



[ Reply to This | # ]
Dramatically reduce the CPU usage of 'top'
Authored by: ChiefTypist on Feb 21, '04 01:58:19AM

I'm the author of iPulse and the quote mentioned in the parent post...

The problem is that top (and other monitoring applications) sample the CPU usage during the time that it is scheduled to consume CPU and, as such, it will always sample itself at a higher usage than normal and everything else at a slightly lower usage.

Any calls to host_processor_info(), task_info(), thread_info() are very likely take snapshots at a point in time where usage is artificially high.

If you want to get an idea of how much CPU usage an application like top, iPulse, or Activity Monitor is using, you should use another application to sample with.



[ Reply to This | # ]
Dramatically reduce the CPU usage of 'top'
Authored by: deleted_user18 on Feb 21, '04 04:34:23AM

But why is this different on Linux? Wheter I look at a Dual-Xeon or an old Pentium III server I always get a load for top of less than 2%.



[ Reply to This | # ]
Dramatically reduce the CPU usage of 'top'
Authored by: avarame on Feb 21, '04 05:23:30PM

I just ran two copies of top, and compared their monitoring of each other. One was the modified version mentioned here, the other was plain-jane /usr/bin/top. /usr/bin/top and 'ttop' agreed within a couple of percent on CPU usage by /usr/bin/top. The differences went both positive and negative (that is, there was no bias by either copy of top in either direction).

In any case, average top CPU usage has gone down from 15-20% to 2-5% on a 700Mhz G3! Thanks so much!!



[ Reply to This | # ]