Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main(int argc, char **argv) {
- // ProcessTime example
- struct timeval startTime;
- struct timeval endTime;
- // get the current time
- // - NULL because we don't care about time zone
- gettimeofday(&startTime, NULL);
- // algorithm goes here
- what_you_want_to_time();
- // get the end time
- gettimeofday(&endTime, NULL);
- // calculate the time
- printf("Execution time: %ld.%d\n", (endTime.tv_sec - startTime.tv_sec), (endTime.tv_usec - startTime.tv_usec));
- return 0;
- }
Add Comment
Please, Sign In to add comment