getting particular thread cpu time

Julian Elischer julian at elischer.org
Wed Feb 1 11:20:18 PST 2006


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?



More information about the freebsd-threads mailing list