15 #ifndef CORE_UTIL_TIMING_H_
16 #define CORE_UTIL_TIMING_H_
31 typedef std::chrono::high_resolution_clock
Clock;
34 using std::chrono::duration_cast;
35 using std::chrono::milliseconds;
36 auto time = Clock::now();
37 auto since_epoch = time.time_since_epoch();
38 auto millis = duration_cast<milliseconds>(since_epoch);
39 return millis.count();
42 template <
typename TFunctor>
43 static void Time(
const std::string& description, TFunctor&& f) {
47 Timing timing(description, agg);
54 explicit Timing(
const std::string& description =
"")
63 std::cout <<
text_ <<
" " << duration <<
" ms" << std::endl;
77 #endif // CORE_UTIL_TIMING_H_