On Fri, Feb 5, 2010 at 4:28 PM, Dan Nelson <dnel...@allantgroup.com> wrote:
> Ideally, top and ps would total up all
> the per-thread CPU counts when displaying the per-process numbers, but it
> doesn't seem to.

It does seem to total them:

$ ps axHo pid,lwp,time,wchan,comm | awk '$1 == 1647'
 1647 100401   0:00.63 select mysqld
 1647 100466   0:11.08 sigwai mysqld
 1647 100521   0:00.00 ucond  mysqld
$ ps axo pid,lwp,time,wchan,comm | awk '$1 == 1647'
 1647 100521   0:11.71 ucond  mysqld

But you put me on the right track.  I ran both side by side for
awhile, and found that ps/top only sums up those threads that haven't
already exited.  I.e., once a thread has exited, it's as if its usage
never happened from the perspective of ps and top's total calculation.

That seems like undesirable behavior, particularly if it conceals
CPU-churning behavior by short-lived threads, but possibly very hard
to change. :(

I wonder if the system accounting records are more accurate?

Thanks for pointing me in the right direction!
_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"

Reply via email to