Subj : Re: Per thread cpu-usage on Linux To : comp.programming.threads From : David Schwartz Date : Wed Feb 16 2005 04:24 pm "John G. Shaw" wrote in message news:1117lllc05lhi4d@corp.supernews.com... > The intent was to use the pthread_getcpuclockid() function within a > running thread (i.e., a function invoked via pthread_create()). I'm a bit > surprised it even runs under the main program (I thought pthread_self() > would not be valid or even crash). I have used this approach successfully > on a parallel computer (SGI Altix series), and it seems to return the > thread's CPU time as opposed to "real time" in the thread. It's possible > that pthread_self() does not return a thread-dependent clock_id if it is > not invoked under a running pthread. It's also possible this may be a > system-dependent behaviour. SGI's linux has been significantly modified > from most others. (???) Does clock_gettime(CLOCK_THREAD_CPUTIME_ID, ...); work? DS .