Last active
July 25, 2019 21:00
-
-
Save githole/eb1417026598492cbbc032ffc305d64b to your computer and use it in GitHub Desktop.
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
#include <chrono> | |
struct TIMER final | |
{ | |
std::chrono::system_clock::time_point start, end; | |
const char* str; | |
TIMER(const char* s) : str(s) | |
{ | |
start = std::chrono::system_clock::now(); | |
} | |
~TIMER() | |
{ | |
end = std::chrono::system_clock::now(); | |
const double elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count(); | |
printf("%s: %f", str, elapsed); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment