For linux:
clock_gettime()
CLOCK_PROCESS_CPUTIME_ID
(since Linux 2.6.12)
This is a clock that measures CPU time consumed by this process (i.e., CPU time consumed by all threads in the process). On Linux, this clock is not settable.
CLOCK_THREAD_CPUTIME_ID
(since Linux 2.6.12)
This is a clock that measures CPU time consumed by this thread. On Linux, this clock is not settable.