From owner-freebsd-hackers@FreeBSD.ORG Fri Feb 5 22:45:03 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 3ECAE106566B for ; Fri, 5 Feb 2010 22:45:03 +0000 (UTC) (envelope-from linda.messerschmidt@gmail.com) Received: from mail-ew0-f211.google.com (mail-ew0-f211.google.com [209.85.219.211]) by mx1.freebsd.org (Postfix) with ESMTP id CB5818FC19 for ; Fri, 5 Feb 2010 22:45:02 +0000 (UTC) Received: by ewy3 with SMTP id 3so2056382ewy.13 for ; Fri, 05 Feb 2010 14:45:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=3KKe+gmkKPb5boj5UHPmJB2wovt7cQfpfsAyTd7RVP8=; b=ZPaVDD1CSiWkjR1n9VB0kWi6BEuyF7X9cgQG2E9FfdVPrbCpVyZCvVtbJCAN78hvOi O5DhGNJlq99A2djuMSU6u/8BYlkedR/OFS4RLYupTuWXABdKfSpDQDNraLRU62uK2mbx EpjLpaElmzzROGx6Wnpy1DZ+8V3F8dJoap4Rc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=LKBU2OYOmdqqCwH6r3osWMSVZCVrmwG9P/n+0cQ/anKUojI0mVysYGDIwltdpGdVAC FapZVraJUJ1vsp0n39m8tV/hDKwX84K4wsN/xzTBos1xYb/rvFKS9+7qtgtbGuFEoyKJ +w/61I8LSnSsrS1JgoIiy6hVFasXNtKD/mVtE= MIME-Version: 1.0 Received: by 10.216.86.11 with SMTP id v11mr1857875wee.220.1265409901626; Fri, 05 Feb 2010 14:45:01 -0800 (PST) In-Reply-To: <20100205212837.GA43582@dan.emsphone.com> References: <237c27101002050857r78003779mb41eae44f850829b@mail.gmail.com> <20100205212837.GA43582@dan.emsphone.com> Date: Fri, 5 Feb 2010 17:45:01 -0500 Message-ID: <237c27101002051445m3392115bhf8ed2ae61d56e0fa@mail.gmail.com> From: Linda Messerschmidt To: Dan Nelson Content-Type: text/plain; charset=ISO-8859-1 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 22:45:03 -0000 On Fri, Feb 5, 2010 at 4:28 PM, Dan Nelson 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!