From owner-freebsd-threads@FreeBSD.ORG Thu Feb 16 21:58:09 2012 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 112F010657C3 for ; Thu, 16 Feb 2012 21:58:09 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay02.stack.nl [IPv6:2001:610:1108:5010::104]) by mx1.freebsd.org (Postfix) with ESMTP id 7B0688FC13 for ; Thu, 16 Feb 2012 21:58:08 +0000 (UTC) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mx1.stack.nl (Postfix) with ESMTP id 39C3A35B3F0; Thu, 16 Feb 2012 22:58:07 +0100 (CET) Received: by snail.stack.nl (Postfix, from userid 1677) id 1FF7A28468; Thu, 16 Feb 2012 22:58:07 +0100 (CET) Date: Thu, 16 Feb 2012 22:58:07 +0100 From: Jilles Tjoelker To: Christoph Splittgerber Message-ID: <20120216215806.GA65161@stack.nl> References: <813D616D-66E4-41BB-9D4C-BB736268B88A@sdata.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <813D616D-66E4-41BB-9D4C-BB736268B88A@sdata.de> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: "freebsd-threads@freebsd.org" Subject: Re: How to map a thread-id to a thread-address 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: Thu, 16 Feb 2012 21:58:09 -0000 On Thu, Feb 16, 2012 at 03:10:47PM +0100, Christoph Splittgerber wrote: > Hallo, I hope his is the correct maling list for his: > I need a per thread overview of CPU time used. > I found out that a "ps -H -otdaddr,time" gives me exactly this. The > question now is, how to relate the thread-address printed by the ps > command to my threads. I did let the program print the thread-ids, and > the threads stack-address but non of them correlate to the address > printed by ps. > I would be grateful for any pointers. The keyword for the thread ID is lwp, apparently for compatibility with other OSes. Alternatively, you can modify your code to set thread names using pthread_set_name_np() and use the tdnam keyword. -- Jilles Tjoelker