From owner-freebsd-bugs@FreeBSD.ORG Sat Mar 28 21:50:01 2009 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AA9B61065679 for ; Sat, 28 Mar 2009 21:50:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 862808FC1A for ; Sat, 28 Mar 2009 21:50:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id n2SLo1Oc050902 for ; Sat, 28 Mar 2009 21:50:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id n2SLo1D8050901; Sat, 28 Mar 2009 21:50:01 GMT (envelope-from gnats) Resent-Date: Sat, 28 Mar 2009 21:50:01 GMT Resent-Message-Id: <200903282150.n2SLo1D8050901@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Alexander Zagrebin Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5B8B0106566B for ; Sat, 28 Mar 2009 21:43:26 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id 4980D8FC16 for ; Sat, 28 Mar 2009 21:43:26 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id n2SLhPG0035204 for ; Sat, 28 Mar 2009 21:43:25 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id n2SLhP4V035203; Sat, 28 Mar 2009 21:43:25 GMT (envelope-from nobody) Message-Id: <200903282143.n2SLhP4V035203@www.freebsd.org> Date: Sat, 28 Mar 2009 21:43:25 GMT From: Alexander Zagrebin To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: bin/133168: top without -H switch reports incorrect time for multithreaded processes X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Mar 2009 21:50:02 -0000 >Number: 133168 >Category: bin >Synopsis: top without -H switch reports incorrect time for multithreaded processes >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Mar 28 21:50:01 UTC 2009 >Closed-Date: >Last-Modified: >Originator: Alexander Zagrebin >Release: 7.1-RELEASE >Organization: >Environment: FreeBSD gw.xxxxxxxx.xx 7.1-RELEASE FreeBSD 7.1-RELEASE #0: Mon Jan 5 16:27:35 MSK 2009 root@gw.xxxxxxxx.xx:/usr/obj/usr/src/sys/KERNEL i386 >Description: When top displays "threads as a count" (without -H switch), it reports incorrect time for multithreaded processes. For example: $ top -H -d1 100 | grep named 844 bind 44 0 26476K 8168K ucond 2:28 0.00% named 844 bind 44 0 26476K 8168K select 0:17 0.00% named 844 bind 44 0 26476K 8168K ucond 0:09 0.00% named 844 bind 20 0 26476K 8168K sigwai 0:00 0.00% named So without -H switch top have to report about 2:54 of a time, but... $ top -d1 100 | grep named 844 bind 4 44 0 26476K 8168K select 0:17 0.00% named It seems that in this case top displays time of the first thread only. >How-To-Repeat: See full description >Fix: After this patch I have the correct result: --- src/usr.bin/top/machine.c.orig 2009-03-05 20:35:56.000000000 +0300 +++ src/usr.bin/top/machine.c 2009-03-29 00:14:53.000000000 +0300 @@ -724,6 +724,7 @@ active_procs++; prev_pp = pp; } else { + prev_pp->ki_runtime += pp->ki_runtime; prev_pp->ki_pctcpu += pp->ki_pctcpu; } } >Release-Note: >Audit-Trail: >Unformatted: