Sample Header Ad - 728x90

Is it possible to get the CPU time of any thread on Linux by calling clock_gettime?

1 vote
1 answer
1209 views
If I know the TID of an arbitrary thread that is running on my system, I can easily compute its pthread cpu clock ID. But would I be able to call clock_gettime from my program and get its CPU time? My experiments suggest it's not possible, but I wasn't able to find the sources to confirm this. If not, is there a way to get hi-res CPU time for a given thread? /proc/stat gives that information but I'd like something more accurate than jiffies.
Asked by Phoenix87 (131 rep)
Mar 18, 2021, 01:24 AM
Last activity: Mar 19, 2021, 08:52 PM