[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: getting particular thread cpu time
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