Easy3D 2.5.3
StopWatch Class Reference

A high resolution stop watch/timer. More...

#include <easy3d/util/stop_watch.h>

Public Member Functions

 StopWatch ()
 default constructor. The watch will automatically start after construction.
 
 ~StopWatch ()=default
 destructor.
 
void start ()
 starts the timer
 
void restart ()
 restarts the timer. It has the same effect as start()
 
double elapsed_seconds (int num_digits=1) const
 returns user elapsed time (in seconds) since the construction / start.
 
std::string time_string (int num_digits=1) const
 the elapsed time string, e.g., 88ms, 2.3s, 1.7m, 0.1h. This function automatically determines the best unit.
 

Detailed Description

A high resolution stop watch/timer.

This timer is able to measure the elapsed time with 1 micro-second accuracy on Windows, Linux, and Unix. Usage example:

// do task_1 ...
LOG(INFO) << "task_1 done. Time: " << w.time_string() << " seconds";
w.start();
// do task_2 ...
LOG(INFO) << "task_2 done. Time: " << w.time_string() << " seconds";
StopWatch()
default constructor. The watch will automatically start after construction.
Definition: stop_watch.cpp:44

The documentation for this class was generated from the following files: