I'm writing an application using C++ and OpenMP and I want to reliably (and correctly) measure time of execution of parts of it. I have reviewed a few options (Windows, TDM-GCC x64 4.8.1):
omp_get_wproc
andclock
seem to do the job but documentation (in direct contradiction to actual behavior) says that they measure total time resources consumed by given process (that is, e.g. one second with two working threads counts as two seconds). The "correct" behavior is not what I want,time
/difftime
don't have enough resolution,GetProcessTime
(WinAPI) does what clock should do and is platform-specific,QueryPerformanceCounter
(WinAPI) seems to be the way to go but is platform-specific,- C++11
high_resolution_clock
works ok but it's a part of a new standard.
My question, primarily, is: how do people doing scientific computing do this, and why do it that way? And, is the behavior of clock
a bug in my implementation of standard library or a too popular misconception?
EDIT: Small explanation: I'm a bit hesitant to use C++11 because I'll probably run my code on a cluster with somewhat old software.