From owner-freebsd-threads@FreeBSD.ORG Wed Feb 1 13:33:51 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 D8B3D16A420 for ; Wed, 1 Feb 2006 13:33:51 +0000 (GMT) (envelope-from deischen@freebsd.org) Received: from mail.ntplx.net (mail.ntplx.net [204.213.176.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8293743D45 for ; Wed, 1 Feb 2006 13:33:49 +0000 (GMT) (envelope-from deischen@freebsd.org) Received: from sea.ntplx.net (sea.ntplx.net [204.213.176.11]) by mail.ntplx.net (8.13.5/8.13.5/NETPLEX) with ESMTP id k11DXmX5020619; Wed, 1 Feb 2006 08:33:48 -0500 (EST) Date: Wed, 1 Feb 2006 08:33:48 -0500 (EST) From: Daniel Eischen X-X-Sender: eischen@sea.ntplx.net To: Ilya E Veretenkin In-Reply-To: <408955619.20060201150429@mail.ru> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by AMaViS and Clam AntiVirus (mail.ntplx.net) Cc: 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 Reply-To: Daniel Eischen List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Feb 2006 13:33:52 -0000 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. -- DE