top shows that multithreaded program uses 19623.14% CPU

Dan Nelson dnelson at allantgroup.com
Sat Jun 13 18:43:09 UTC 2009


In the last episode (Jun 13), Yuri said:
> I ran then program with 1500 threads and in top it looked the this:
> 
>  PID USERNAME    THR PRI NICE   SIZE    RES STATE   C   TIME    CPU COMMAND
> 20382 yuri       1500  99    0   641M   462M umtxn   0   0:00 19623.14%  quicksort
> <skipped further>
> 
> Where can I read how CPU column is calculated?
> 
> Some time ago I saw another weird fenomenon when CPU column: 5% CPU load 
> for the pocess that just cycles in CPU.

Top doesn't seem to show the right %CPU at all for threaded apps unless you
hit H to view each thread individually.  Then you get accurate numbers (but
you have to manually sum up the threads usage if you want to see the total
%CPU for an entire process).

-- 
	Dan Nelson
	dnelson at allantgroup.com


More information about the freebsd-hackers mailing list