Feature Selection Toolbox FST4
UTIA · Czech Academy of Sciences
Loading...
Searching...
No Matches

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.

Detailed Description

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.

Member Function Documentation

◆ print()

std::ostream & FST::StopWatch::print ( std::ostream & os) const
inline

Writes elapsed time formatted as "StopWatch time: D:HH:MM:SS (equals N seconds)" to os.

Parameters
osthe stream to write to

The documentation for this class was generated from the following file:
Copyright © 2000–present ÚTIA, Institute of Information Theory and Automation of the Czech Academy of Sciences · Contacts · This site sets no cookies and uses no analytics.