4

We're using getrusage() when compiling on Linux to gain some insights into how much CPU-time some operations take in each thread:

getrusage(RUSAGE_THREAD, &before);
.... do work ....
getrusage(RUSAGE_THREAD, &after);

However, because the call is not available on Windows, we have to #ifdef it out on the platform.

I'm sure, Windows has its own means of obtaining the same information, but I'm wondering, if there is a portable way -- either with a standard C++11, or with Boost, which we already use in the project anyway...

Mikhail T.
  • 3,043
  • 3
  • 29
  • 46

0 Answers0