atom feed3 messages in org.freebsd.freebsd-hackersWhy top never shows ~100% CPU usage w...
FromSent OnAttachments
YuriMay 1, 2009 11:27 am 
Alexey ShuvaevMay 1, 2009 11:38 am 
YuriMay 1, 2009 11:50 am 
Subject:Why top never shows ~100% CPU usage with heavy PCU load?
From:Yuri (yu@rawbw.com)
Date:May 1, 2009 11:27:39 am
List:org.freebsd.freebsd-hackers

When I run cycle process: main() {for (;;) {}} I never see that it consumes ~100% CPU. Instead 'top -C' shows something like this, with numbers fluctuating around the shown numbers:

CPU: 96.2% user, 0.0% nice, 20.0% system, 0.0% interrupt, 0.0% idle Mem: 653M Active, 995M Inact, 241M Wired, 90M Cache, 112M Buf, 11M Free Swap: 16G Total, 204M Used, 16G Free, 1% Inuse, 16K In

PID USERNAME THR PRI NICE SIZE RES STATE TIME CPU COMMAND 85422 yuri 1 99 0 2520K 980K RUN 0:21 57.47% cycle <skipped minor loads>

Total of CPU column for all processes is never what top shows in "CPU:" field. At the same time kde system guard app shows 100% overall CPU load and same cycle app shows as consuming ~85% CPU. So system guard always shows consistently higher number for the same process than top -C shows.

On Linux process the cycle app shows as consuming <~100% CPU and total is also <~100% that makes sense.

Why top's "CPU:" field doesn't equal total of all CPUs for all processes that it shows? Why top doesn't show ~100% CPU consumption for the cycle process? Why sysguard in kde consistently shows higher CPU consumption numbers than top -C?