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

next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (Feb 05), Linda Messerschmidt said:
> For most of 7.2, on up to a 7.3-PRERELEASE built yesterday, I've noticed
> that the "time" field reported by ps and top jumps around for some
> processes.  I've particularly noticed it with MySQL.
> 
> Here are some repeated ps results (ps axo pid,time,wchan,comm) for the
> same process over a few minutes:
> 
>  1647   0:08.06 ucond  mysqld
>  1647   0:08.06 ucond  mysqld
>  1647   0:08.06 ucond  mysqld
>  1647   0:08.06 ucond  mysqld
>  1647   0:08.07 ucond  mysqld
>  1647   0:10.24 wdrain mysqld
>  1647   0:08.08 ucond  mysqld
>  1647   0:09.25 -      mysqld
> 
> It's like when it starts working it builds up time, but as soon as it
> goes back to ucond, it resets back to the earlier value.

By default, ps only lists one thread when listing threaded processes, and if
it's anything like top, the CPU column seems to be randomly picked from one
thread.  Try running "ps axHo pid,lwp,time,wchan,comm" instead (add H and
lwp).

That will print the individual threads, plus the thread id so you can track
them across runs.  You should see one thread with a CPU value of "8.08" (or
so), and other values for the rest.  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.

-- 
	Dan Nelson
	dnelson@allantgroup.com



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