CLOCKTHREADCPUTIMEID
CLOCK_THREAD_CPUTIME_ID is a clock ID used with POSIX clock APIs to obtain the amount of CPU time consumed by a thread. When passed to clock_gettime, clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts) returns a timespec representing the CPU time that the calling thread has spent executing on the processor since the clock started for that thread. This is distinct from wall-clock time; it measures only the time the thread spends running on the CPU and includes time spent in both user mode and kernel mode.
Because it is per-thread, the measurement reflects only the thread's own activity and does not account for
Usage notes: This clock is commonly used for profiling, performance tuning, or implementing per-thread quotas. It
Availability and portability: CLOCK_THREAD_CPUTIME_ID is supported on Linux with glibc and other POSIX-like systems that expose
See also: CLOCK_PROCESS_CPUTIME_ID, clock_gettime, timespec.