Skip to content

Instantly share code, notes, and snippets.

@tomykaira
Created November 16, 2014 06:32
Show Gist options
  • Save tomykaira/64c0eabd7213ece1c04e to your computer and use it in GitHub Desktop.
Save tomykaira/64c0eabd7213ece1c04e to your computer and use it in GitHub Desktop.
Measure elapsed time in C++
#include <chrono>
#include <iostream>
auto start = std::chrono::high_resolution_clock::now();
// do something
auto end = std::chrono::high_resolution_clock::now();
std::cout << std::chrono::duration_cast<std::chrono::microseconds>(end - start).count() << std::endl;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment