Skip to content

Instantly share code, notes, and snippets.

@cherichy
Last active February 22, 2024 12:22
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cherichy/4a7ebd71c7b3c479afb7834bccc89ecd to your computer and use it in GitHub Desktop.
Save cherichy/4a7ebd71c7b3c479afb7834bccc89ecd to your computer and use it in GitHub Desktop.
Marco for timer of high accuracy
#include <chrono>
#define TIMER(Run) [&](){\
auto t1 = std::chrono::system_clock::now();\
auto res = Run;\
auto t2 = std::chrono::system_clock::now();\
auto dt = std::chrono::duration_cast<std::chrono::milliseconds>(t2-t1).count();\
std::cout << #Run << " elapsed time: " << dt << "ms" << std::endl;\
return res;\
}()
@pagesys
Copy link

pagesys commented Jan 29, 2020

God Chi is so power B

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment