-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtime.hpp
More file actions
14 lines (13 loc) · 851 Bytes
/
time.hpp
File metadata and controls
14 lines (13 loc) · 851 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <chrono>
#include <string>
#define TIME(...) \
do { \
auto _start_time = std::chrono::steady_clock::now(); \
__VA_ARGS__; \
auto _end_time = std::chrono::steady_clock::now(); \
auto _milliseconds = \
std::chrono::duration_cast<std::chrono::milliseconds>(_end_time - \
_start_time) \
.count(); \
std::cout << #__VA_ARGS__ << ": " << _milliseconds << " ms" << std::endl; \
} while (0)