Simple stopwatch to measure run time of search algorithms. More...
#include <stopwatch.hpp>
Public Member Functions | |
| double | time_elapsed () const |
| Returns the number of whole seconds elapsed since construction (wall-clock via time(), one-second resolution). | |
| std::ostream & | print (std::ostream &os) const |
Writes elapsed time formatted as "StopWatch time: D:HH:MM:SS (equals N seconds)" to os. | |
Private Attributes | |
| time_t | first |
| wall-clock time captured at construction, the time_elapsed() baseline | |
| std::mutex | timeelapsed_mutex |
serializes concurrent time_elapsed() calls on one StopWatch (FST_THREADED only); first itself is written at construction and never changes afterwards | |
Friends | |
| std::ostream & | operator<< (std::ostream &os, const StopWatch &sw) |
Streams a StopWatch's print() (formatted elapsed time) to os. | |
Simple stopwatch to measure run time of search algorithms.
The clock starts when the object is constructed and there is no way to stop, pause or reset it - measure another interval by constructing another StopWatch. Resolution is one second (wall-clock time()), which is what the search algorithms' progress messages need; it is not a profiling instrument.
|
inline |
Writes elapsed time formatted as "StopWatch time: D:HH:MM:SS (equals N seconds)" to os.
| os | the stream to write to |