Expand description
Per-thread CPU time (owned by the facade work, for the stall watchdog). Per-thread CPU time, for telling a slow handler from a preempted thread.
thread_times reads the calling thread’s CPU time and, on Linux, its count of voluntary
context switches (the thread blocked: sleep, I/O, a contended lock). A loop thread that was
only preempted shows wall time but neither CPU time nor voluntary switches.
- Linux (64-bit):
clock_gettime(CLOCK_THREAD_CPUTIME_ID)for the CPU time andgetrusage(RUSAGE_THREAD)for the switches.getrusage’s CPU times are only as fresh as the last scheduler tick for a running thread, so they miss most of a short call. - Other Unix:
clock_gettime(CLOCK_THREAD_CPUTIME_ID), CPU time only. - Windows:
QueryThreadCycleTime, converted to nanoseconds with a cycle rate measured once (about 1.5 ms of spinning on the first call).
This file is owned by the facade work (the stall watchdog in simoom).
Structs§
- Thread
Times - CPU time used by the calling thread so far.
Functions§
- thread_
times - The calling thread’s CPU time, or
Nonewhere it can’t be read.