Skip to content

Instantly share code, notes, and snippets.

@gchudnov
Created November 6, 2014 19:26
Show Gist options
  • Save gchudnov/5d88cd3a393c9f4b4210 to your computer and use it in GitHub Desktop.
Save gchudnov/5d88cd3a393c9f4b4210 to your computer and use it in GitHub Desktop.
Measure elapsed time
#include <iostream>
#include <chrono>
int main() {
auto t0(std::chrono::steady_clock::now());
// some code to measure time for
auto t1(std::chrono::steady_clock::now());
auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(t1 - t0);
std::cout << duration.count() << std::endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment