Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 1 Feb 2006 08:33:48 -0500 (EST)
From:      Daniel Eischen <deischen@freebsd.org>
To:        Ilya E Veretenkin <ilyaver@mail.ru>
Cc:        freebsd-threads@freebsd.org
Subject:   Re: getting particular thread cpu time
Message-ID:  <Pine.GSO.4.43.0602010829250.7356-100000@sea.ntplx.net>
In-Reply-To: <408955619.20060201150429@mail.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.43.0602010829250.7356-100000>