Last active
October 4, 2019 21:28
-
-
Save jeromew21/28b71cc18b9941f6b7e79424e593aa97 to your computer and use it in GitHub Desktop.
Simple execution timer (C++)
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 <chrono> | |
/* | |
* ... | |
*/ | |
auto start = std::chrono::high_resolution_clock::now(); | |
/* | |
* do stuff | |
*/ | |
auto stop = std::chrono::high_resolution_clock::now(); | |
auto duration = std::chrono::duration_cast<std::chrono::nanoseconds>(stop - start); //or milliseconds | |
unsigned long duration_count = duration.count(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment