Created
March 4, 2020 15:58
-
-
Save hpwxf/76694a5b6ed8d4052097545f2d9a6125 to your computer and use it in GitHub Desktop.
Time measure using std::chrono
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
const auto start = std::chrono::system_clock::now(); | |
process(...) | |
const auto end = std::chrono::system_clock::now(); | |
auto elapsed = [=](auto start, auto end) { | |
return std::chrono::duration_cast<std::chrono::microseconds>(end - start).count(); | |
}; | |
double duration = static_cast<double>(elapsed(start, end)) / 1000; // as ms |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment