In C++, I use a scheme of:
double tic=clock()
double timeElapsedSec=(clock()-tic)/CLOCKS_PER_SEC
to time things in seconds.
However, the timing seems to be accurate in debug mode, but it seems to be inaccurate in release mode. Possible that the -O3 optimization flag does something funky with moving these variables around.
Consider switching to a different timing method in the standard library (if one exists?) or switch to using the boost timers (think it's in the chrono library).
In C++, I use a scheme of:
double tic=clock()
double timeElapsedSec=(clock()-tic)/CLOCKS_PER_SEC
to time things in seconds.
However, the timing seems to be accurate in debug mode, but it seems to be inaccurate in release mode. Possible that the -O3 optimization flag does something funky with moving these variables around.
Consider switching to a different timing method in the standard library (if one exists?) or switch to using the boost timers (think it's in the chrono library).