Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sys/time.h> // for gettimeofday() in Linux
- // QueryPerformanceCounter and QueryPerformanceFrequency for Windows
- timeval t1, t2;
- double elapsedTime;
- gettimeofday(&t1, NULL);
- gettimeofday(&t2, NULL);
- elapsedTime = (t2.tv_sec - t1.tv_sec) * 1000.0; // sec to ms
- elapsedTime += (t2.tv_usec - t1.tv_usec) / 1000.0; // us to ms
- cout << elapsedTime << " ms.\n";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement