Re: time used by a thread

2008-07-03 Thread Sergey Babkin

>I want to use getrusage to see how much time a program is using.  But 
>this is a multithreaded program, and I just want the time taken by that 
>particular thread!
>
>I know this info must be available somewhere, because top -H seems to 
>provide it.  But getrusage seems to give the total rusage for the whole 
>program, not just the thread.
>
>Any ideas?  I would especially appreciate a portable solution that works 
>for OS other than FreeBSD (e.g. linux, etc as well).

On Linux and Solaris it can be done by reading the /proc filesystem.
Probably on FreeBSD too, haven't tried. But it's different on each OS.

-SB
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: time used by a thread

2008-07-03 Thread Stephen Montgomery-Smith

Sergey Babkin wrote:
I want to use getrusage to see how much time a program is using.  But 
this is a multithreaded program, and I just want the time taken by that 
particular thread!


I know this info must be available somewhere, because top -H seems to 
provide it.  But getrusage seems to give the total rusage for the whole 
program, not just the thread.


Any ideas?  I would especially appreciate a portable solution that works 
for OS other than FreeBSD (e.g. linux, etc as well).


On Linux and Solaris it can be done by reading the /proc filesystem.
Probably on FreeBSD too, haven't tried. But it's different on each OS.


Thanks.  I developed a non-portable solution using kvm_getprocs.

___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"