From owner-freebsd-hackers@FreeBSD.ORG Sat Jun 13 18:43:08 2009 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 C6AAC106567A for ; Sat, 13 Jun 2009 18:43:08 +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 836378FC25 for ; Sat, 13 Jun 2009 18:43:08 +0000 (UTC) (envelope-from dan@dan.emsphone.com) 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 n5DIh5p4025785 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sat, 13 Jun 2009 13:43:06 -0500 (CDT) (envelope-from dan@dan.emsphone.com) Received: from dan.emsphone.com (smmsp@localhost [127.0.0.1]) by dan.emsphone.com (8.14.3/8.14.3) with ESMTP id n5DIh54m041318 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sat, 13 Jun 2009 13:43:05 -0500 (CDT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.14.3/8.14.3/Submit) id n5DIh4iP041306; Sat, 13 Jun 2009 13:43:04 -0500 (CDT) (envelope-from dan) Date: Sat, 13 Jun 2009 13:43:04 -0500 From: Dan Nelson To: Yuri Message-ID: <20090613184303.GK56070@dan.emsphone.com> References: <4A33544C.1070902@rawbw.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4A33544C.1070902@rawbw.com> X-OS: FreeBSD 7.2-STABLE User-Agent: Mutt/1.5.19 (2009-01-05) X-Virus-Scanned: ClamAV version 0.94.1, clamav-milter version 0.94.1 on 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]); Sat, 13 Jun 2009 13:43:06 -0500 (CDT) X-Scanned-By: MIMEDefang 2.45 Cc: freebsd-hackers@freebsd.org Subject: Re: top shows that multithreaded program uses 19623.14% CPU 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: Sat, 13 Jun 2009 18:43:09 -0000 In the last episode (Jun 13), Yuri said: > I ran then program with 1500 threads and in top it looked the this: > > PID USERNAME THR PRI NICE SIZE RES STATE C TIME CPU COMMAND > 20382 yuri 1500 99 0 641M 462M umtxn 0 0:00 19623.14% quicksort > > > Where can I read how CPU column is calculated? > > Some time ago I saw another weird fenomenon when CPU column: 5% CPU load > for the pocess that just cycles in CPU. Top doesn't seem to show the right %CPU at all for threaded apps unless you hit H to view each thread individually. Then you get accurate numbers (but you have to manually sum up the threads usage if you want to see the total %CPU for an entire process). -- Dan Nelson dnelson@allantgroup.com