From owner-freebsd-threads@FreeBSD.ORG Wed Feb 1 19:20:18 2006 Return-Path: X-Original-To: freebsd-threads@freebsd.org Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A02FF16A420; Wed, 1 Feb 2006 19:20:18 +0000 (GMT) (envelope-from julian@elischer.org) Received: from a50.ironport.com (a50.ironport.com [63.251.108.112]) by mx1.FreeBSD.org (Postfix) with ESMTP id 64ADC43D46; Wed, 1 Feb 2006 19:20:18 +0000 (GMT) (envelope-from julian@elischer.org) Received: from unknown (HELO [10.251.17.229]) ([10.251.17.229]) by a50.ironport.com with ESMTP; 01 Feb 2006 11:20:18 -0800 Message-ID: <43E109F1.6020304@elischer.org> Date: Wed, 01 Feb 2006 11:20:17 -0800 From: Julian Elischer User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7.11) Gecko/20050727 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Daniel Eischen References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Cc: Ilya E Veretenkin , freebsd-threads@freebsd.org Subject: Re: getting particular thread cpu time X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Feb 2006 19:20:18 -0000 Daniel Eischen wrote: >On Wed, 1 Feb 2006, Ilya E Veretenkin wrote: > > > >>Hello. >>I am writing a multi-threaded application and want to see the cpu >>usage of each thread of this application. >>I know that 'ps -H' outputs cpu usage information for threads, but how >>can I found out the correspondence between particular thread in 'ps-H' >>output and particular thread ID in my application? >> >> > >You can't, unless: > > 1) Every thread is system scope; or > 2) You use libthr where every thread maps 1:1 to a kernel thread > >Even then, I don't know whether CPU usage is maintained correctly >yet by the kernel for a multi-threaded process. Someone has been >working on it recently. > >Libpthread is M:N by default, so the kernel doesn't know about >userland threads. > > though we might think about ways that we can get that information.. maybe a way that the user thread scheduler can be asked for the info?