Skip to content

Instantly share code, notes, and snippets.

@addam
Created April 24, 2016 09:30
Show Gist options
  • Save addam/9296ae048eacd6cf64c8b76f34c7f276 to your computer and use it in GitHub Desktop.
Save addam/9296ae048eacd6cf64c8b76f34c7f276 to your computer and use it in GitHub Desktop.
two-liner for measuring elapsed time in C++11
#include <chrono>
std::chrono::high_resolution_clock::time_point t_start = std::chrono::high_resolution_clock::now();
//...
float elapsedTime = std::chrono::duration_cast<std::chrono::duration<float>>(std::chrono::high_resolution_clock::now() - t_start).count();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment