Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 5 Feb 2010 17:45:01 -0500
From:      Linda Messerschmidt <linda.messerschmidt@gmail.com>
To:        Dan Nelson <dnelson@allantgroup.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: ps "time" field jumps backward
Message-ID:  <237c27101002051445m3392115bhf8ed2ae61d56e0fa@mail.gmail.com>
In-Reply-To: <20100205212837.GA43582@dan.emsphone.com>
References:  <237c27101002050857r78003779mb41eae44f850829b@mail.gmail.com> <20100205212837.GA43582@dan.emsphone.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Feb 5, 2010 at 4:28 PM, Dan Nelson <dnelson@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!



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?237c27101002051445m3392115bhf8ed2ae61d56e0fa>