From owner-freebsd-hackers@FreeBSD.ORG Fri Jun 13 04:54:47 2008 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 3D6BB106564A for ; Fri, 13 Jun 2008 04:54:47 +0000 (UTC) (envelope-from stephen@math.missouri.edu) Received: from cauchy.math.missouri.edu (cauchy.math.missouri.edu [128.206.184.213]) by mx1.freebsd.org (Postfix) with ESMTP id BF7098FC0A for ; Fri, 13 Jun 2008 04:54:46 +0000 (UTC) (envelope-from stephen@math.missouri.edu) Received: from laptop3.gateway.2wire.net (cauchy.math.missouri.edu [128.206.184.213]) by cauchy.math.missouri.edu (8.14.2/8.14.2) with ESMTP id m5D4KJ1t086617 for ; Thu, 12 Jun 2008 23:20:19 -0500 (CDT) (envelope-from stephen@math.missouri.edu) Message-ID: <4851F593.2030504@math.missouri.edu> Date: Thu, 12 Jun 2008 23:20:35 -0500 From: Stephen Montgomery-Smith User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.8.1.13) Gecko/20080606 SeaMonkey/1.1.9 MIME-Version: 1.0 To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Small change to top 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, 13 Jun 2008 04:54:47 -0000 top doesn't get TIME right for threaded processes. How about this small change: --- usr.bin/top/machine.c-orig 2008-06-12 23:06:08.000000000 -0500 +++ usr.bin/top/machine.c 2008-06-12 23:06:51.000000000 -0500 @@ -725,6 +725,7 @@ prev_pp = pp; } else { prev_pp->ki_pctcpu += pp->ki_pctcpu; + prev_pp->ki_runtime += pp->ki_runtime; } } (Sorry if the mail client messes up the patch, but it is so short that it can be easily entered by hand.) I do realize that this is not foolproof, because it won't measure any threads that have finished. But it is perhaps a bit better than the current state of affairs, which randomly picks a runtime of one of the threads.