Thrill
0.1
|
Class timer is a simple stop watch timer.
It uses the timestamp() function to get the current time when start() is called. Then, after some processing, the function stop() functions can be called, or seconds() and other accessors can be called directly.
#include <timer.hpp>
Public Member Functions | |
timer (bool start_immediately=false) | |
initialize and optionally immediately start the timer More... | |
double | mseconds () const |
return currently accumulated time in milliseconds More... | |
timer & | operator+= (const timer &tm) |
accumulate elapsed time from another timer More... | |
void | reset () |
return accumulated time More... | |
double | seconds () const |
return currently accumulated time in seconds (as double) More... | |
void | start () |
start timer More... | |
void | stop () |
stop timer More... | |
double | useconds () const |
return currently accumulated time in microseconds More... | |
Static Public Attributes | |
static const bool | is_real = true |
boolean indicating that this class does real timing More... | |
Static Private Member Functions | |
static double | timestamp () |
return current timestamp More... | |
Private Attributes | |
double | accumulated |
total accumulated time in seconds. More... | |
double | last_clock |
last start time of the stopwatch More... | |
std::mutex | mutex_accumulated |
guard accumulated More... | |
bool | running |
boolean whether the stopwatch timer is currently running More... | |
Friends | |
std::ostream & | operator<< (std::ostream &os, const timer &t) |
direct <<-operator for ostream. Can be used for printing with std::cout. More... | |
|
inlineexplicit |
initialize and optionally immediately start the timer
Definition at line 75 of file timer.hpp.
References timer::start().
|
inline |
return currently accumulated time in milliseconds
Definition at line 107 of file timer.hpp.
References timer::timestamp().
accumulate elapsed time from another timer
Definition at line 144 of file timer.hpp.
References examples::select::delta, and timer::seconds().
|
inline |
|
inline |
return currently accumulated time in seconds (as double)
Definition at line 131 of file timer.hpp.
References examples::select::delta, timer::last_clock, and timer::timestamp().
Referenced by timer::operator+=(), and scoped_print_timer::~scoped_print_timer().
|
inline |
start timer
Definition at line 82 of file timer.hpp.
References timer::timestamp().
Referenced by timer::timer().
|
inline |
stop timer
Definition at line 89 of file timer.hpp.
References examples::select::delta, timer::last_clock, and timer::timestamp().
|
inlinestaticprivate |
return current timestamp
Definition at line 62 of file timer.hpp.
References foxxll::timestamp().
Referenced by timer::mseconds(), timer::reset(), timer::seconds(), timer::start(), timer::stop(), and timer::useconds().
|
inline |
return currently accumulated time in microseconds
Definition at line 118 of file timer.hpp.
References examples::select::delta, timer::last_clock, and timer::timestamp().
|
friend |
|
private |
|
static |
|
private |
last start time of the stopwatch
Definition at line 59 of file timer.hpp.
Referenced by timer::seconds(), timer::stop(), and timer::useconds().
|
mutableprivate |
|
private |