Created
November 5, 2013 08:47
-
-
Save toxicFork/7315788 to your computer and use it in GitHub Desktop.
Time elapsed
This file contains 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 characters
#define CLOCK_PRECISION (1E9) | |
struct timespec requestStart, requestEnd; | |
clock_gettime(CLOCK_REALTIME, &requestStart); | |
func(grid); | |
clock_gettime(CLOCK_REALTIME, &requestEnd); | |
// Calculate the time it took | |
double accum = ( requestEnd.tv_sec - requestStart.tv_sec ) | |
+ ( requestEnd.tv_nsec - requestStart.tv_nsec ) | |
/ CLOCK_PRECISION; | |
printf("Time elapsed: %fs\n",accum); | |
return accum; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment