getrusage with pthreads

David Xu davidxu at
Tue Oct 7 03:30:46 UTC 2008

Petri Helenius wrote:
> Is there a way to get thread-specific CPU utilization like the getrusage 
> returns for the whole process? Looking at the kernel sources the 
> utilization is accumulated on thread basis and then summed up but it 
> would be useful to be able to determine utilization on a single thread 
> between two checkpoints. Would pmc or ITIMER_PROF help?
> Pete

You can use clock_gettime(CLOCK_THREAD_CPUTIME_ID), but I admit
getrusage like function is better.

David Xu

More information about the freebsd-threads mailing list