Created
January 22, 2015 10:33
-
-
Save Erdk/76eeab35ebdf5b5544d9 to your computer and use it in GitHub Desktop.
Revisions
-
Erdk created this gist
Jan 22, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ #define DO_TIMING 1 #if DO_TIMING #define TIME(label, statement) \ do { \ struct timeval tvs, tve; \ gettimeofday(&tvs, NULL); \ do { statement; } while(0); \ gettimeofday(&tve, NULL); \ double tvsd = (double)tvs.tv_sec + (double)tvs.tv_usec/1000000; \ double tved = (double)tve.tv_sec + (double)tve.tv_usec/1000000; \ fprintf(stderr, "%s time: %.5f\n", label, tved-tvsd); \ } while (0) #else #define TIME(label, statement) statement #endif