How to map a thread-id to a thread-address

Jilles Tjoelker jilles at stack.nl
Thu Feb 16 21:58:09 UTC 2012


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


More information about the freebsd-threads mailing list