1 #ifndef MF_UTILITY_STOPWATCH_H_
2 #define MF_UTILITY_STOPWATCH_H_
20 bool running_ =
false;
25 total_duration_ = duration_type::zero();
31 start_time_ = clock_type::now();
37 if(! running_)
return;
41 total_duration_ += duration;
42 start_time_ = end_time;
49 return total_duration_;
duration_type total_duration() const
Get total duration.
Definition: stopwatch.h:47
void stop()
Stop the stopwatch, and add duration since last start() call to total duration.
Definition: stopwatch.h:36
typename clock_type::duration duration_type
Definition: stopwatch.h:15
void reset()
Reset accumulated duration and stop.
Definition: stopwatch.h:24
Stop watch which measures total time passed between start() and stop() calls.
Definition: stopwatch.h:11
std::chrono::high_resolution_clock clock_type
Definition: stopwatch.h:13
typename clock_type::time_point time_point_type
Definition: stopwatch.h:14
void start()
Start the stopwatch.
Definition: stopwatch.h:30
#define MF_ASSERT(condition)
Definition: common.h:24