Skip to content

Instantly share code, notes, and snippets.

View cherichy's full-sized avatar

Yuxi Chi cherichy

  • Beihang University
  • Beijing
View GitHub Profile
@cherichy
cherichy / TIMER.h
Last active February 22, 2024 12:22
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;\
}()