ps "time" field jumps backward
Linda Messerschmidt
linda.messerschmidt at gmail.com
Fri Feb 5 22:45:03 UTC 2010
On Fri, Feb 5, 2010 at 4:28 PM, Dan Nelson <dnelson at 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!
More information about the freebsd-hackers
mailing list