Last active
December 10, 2015 03:18
-
-
Save criso/4374094 to your computer and use it in GitHub Desktop.
Calculate function execution time
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 characters
#include <time.h> | |
#include "lib/dbg.h" | |
void my_function() { | |
} | |
int main (int argc, char const* argv[]) { | |
clock_t begin, end; | |
double time_spent; | |
begin = clock(); | |
my_function(); | |
end = clock(); | |
time_spent = (double)(end - begin) / CLOCKS_PER_SEC; | |
log_info("function exec time: %f", time_spent); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment