Skip to content

Instantly share code, notes, and snippets.

@SCG82
Created November 10, 2020 09:35
Show Gist options
  • Save SCG82/3a4c4ae210312c33cb318a33de0d0c3c to your computer and use it in GitHub Desktop.
Save SCG82/3a4c4ae210312c33cb318a33de0d0c3c to your computer and use it in GitHub Desktop.
Measure execution time of code block in C++
#include <chrono>
auto t1 = std::chrono::high_resolution_clock::now();
// code to measure
auto t2 = std::chrono::high_resolution_clock::now();
auto dur = t2 - t1;
cout << dur.count() / rtc::kNumNanosecsPerMicrosec;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment