Skip to content

Instantly share code, notes, and snippets.

Avatar

Cherichy cherichy

  • Beihang University
  • Beijing
View GitHub Profile
@cherichy
cherichy / TIMER.h
Last active Jan 29, 2020
Marco for timer of high accuracy
View TIMER.h
#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;\
}()