Skip to content

Instantly share code, notes, and snippets.

@Trass3r
Created December 14, 2017 13:24
Show Gist options
  • Select an option

  • Save Trass3r/289392e06f9036b2ac67e8a3f10a21cc to your computer and use it in GitHub Desktop.

Select an option

Save Trass3r/289392e06f9036b2ac67e8a3f10a21cc to your computer and use it in GitHub Desktop.
struct MeasureAndPrintTime
{
std::chrono::steady_clock::time_point start = std::chrono::steady_clock::now();
~MeasureAndPrintTime()
{
auto diff = std::chrono::steady_clock::now() - start;
auto usecs = std::chrono::duration_cast<std::chrono::microseconds>(diff).count();
printf("took %lldus\n", (long long)usecs);
}
} _dummy;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment