From owner-freebsd-hackers@FreeBSD.ORG Fri Feb 5 21:28:45 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 713FD106566B for ; Fri, 5 Feb 2010 21:28:45 +0000 (UTC) (envelope-from dan@dan.emsphone.com) Received: from email1.allantgroup.com (email1.emsphone.com [199.67.51.115]) by mx1.freebsd.org (Postfix) with ESMTP id 38E4F8FC13 for ; Fri, 5 Feb 2010 21:28:44 +0000 (UTC) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by email1.allantgroup.com (8.14.0/8.14.0) with ESMTP id o15LSfeG027729 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 5 Feb 2010 15:28:41 -0600 (CST) (envelope-from dan@dan.emsphone.com) Received: from dan.emsphone.com (smmsp@localhost [127.0.0.1]) by dan.emsphone.com (8.14.4/8.14.3) with ESMTP id o15LSeBI005597 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 5 Feb 2010 15:28:40 -0600 (CST) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.14.4/8.14.3/Submit) id o15LSeEk005595; Fri, 5 Feb 2010 15:28:40 -0600 (CST) (envelope-from dan) Date: Fri, 5 Feb 2010 15:28:40 -0600 From: Dan Nelson To: Linda Messerschmidt Message-ID: <20100205212837.GA43582@dan.emsphone.com> References: <237c27101002050857r78003779mb41eae44f850829b@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <237c27101002050857r78003779mb41eae44f850829b@mail.gmail.com> X-OS: FreeBSD 7.2-STABLE User-Agent: Mutt/1.5.20 (2009-06-14) X-Virus-Scanned: clamav-milter 0.95.3 at email1.allantgroup.com X-Virus-Status: Clean X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0.2 (email1.allantgroup.com [199.67.51.78]); Fri, 05 Feb 2010 15:28:41 -0600 (CST) X-Scanned-By: MIMEDefang 2.45 Cc: freebsd-hackers@freebsd.org Subject: Re: ps "time" field jumps backward X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Feb 2010 21:28:45 -0000 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