I want to report the amount of CPU time used per thread in a server process (written in C/C++ on Linux). I can't find the equivalent of GetThreadTimes() on Windows, but that's what I'm looking for.
Can anyone point me in the right direction?
getrusage(2) with RUSAGE_THREAD. From the man page:
int getrusage(int who, struct rusage *usage);
getrusage() returns resource usage measures for who, which can be one of the following:
[...]
RUSAGE_THREAD (since Linux 2.6.26)
Return resource usage statistics for the calling thread.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With