#include <stopwatch.h>

Public Member Functions | |
| stopw_base (const double tick, const double over=-1.0) | |
| c'tor | |
| virtual | ~stopw_base () |
| d'tor | |
| double | reset () |
| Resets the stopwatch. | |
| void | start () |
| Starts the stopwatch. | |
| double | stop () |
| Stops the stopwatch and returns total time (since last reset). | |
| double | stop_d () |
| Stops the stopwatch and returns time since last start / read. | |
| double | read () |
| Returns the total time without stopping the stopwatch (but resets the differential timer). | |
| double | read_d () |
| Returns the time since last read/start without stopping the stopwatch (but resets the differential timer). | |
Protected Member Functions | |
| virtual double | seconds () const |
| Return the current time, to be overriden in derived classes. | |
| double | adv_stopwatch () |
| Advance the stopwatch, return diff, handle single overflows. | |
Protected Attributes | |
| double | last_time |
| The last time we read/started/stopped the clock. | |
| double | total |
| The total elapsed time since construction or reset. | |
| const double | secs_per_tick |
| Used in seconds() to convert internal time to s. | |
| const double | overflow_secs |
| If we overflow once, we miss this many seconds; We assume that internally long ints are used, i.e. | |
| int | running |
| The status. | |
Definition at line 86 of file stopwatch.h.
| stopw_base::stopw_base | ( | const double | tick, | |
| const double | over = -1.0 | |||
| ) | [inline] |
| virtual stopw_base::~stopw_base | ( | ) | [inline, virtual] |
| virtual double stopw_base::seconds | ( | ) | const [inline, protected, virtual] |
Return the current time, to be overriden in derived classes.
Reimplemented in stopwatch_u, stopwatch_us, and stopwatch_e.
Definition at line 104 of file stopwatch.h.
References secs_per_tick.
Referenced by adv_stopwatch(), and start().
| double stopw_base::adv_stopwatch | ( | ) | [inline, protected] |
Advance the stopwatch, return diff, handle single overflows.
Definition at line 109 of file stopwatch.h.
References last_time, overflow_secs, seconds(), secs_per_tick, and total.
Referenced by read(), read_d(), start(), stop(), and stop_d().
| double stopw_base::reset | ( | ) | [inline] |
| void stopw_base::start | ( | ) | [inline] |
Starts the stopwatch.
Definition at line 145 of file stopwatch.h.
References adv_stopwatch(), last_time, running, and seconds().
| double stopw_base::stop | ( | ) | [inline] |
Stops the stopwatch and returns total time (since last reset).
Definition at line 153 of file stopwatch.h.
References adv_stopwatch(), running, and total.
| double stopw_base::stop_d | ( | ) | [inline] |
Stops the stopwatch and returns time since last start / read.
Definition at line 162 of file stopwatch.h.
References adv_stopwatch(), and running.
| double stopw_base::read | ( | ) | [inline] |
Returns the total time without stopping the stopwatch (but resets the differential timer).
Definition at line 173 of file stopwatch.h.
References adv_stopwatch(), running, and total.
| double stopw_base::read_d | ( | ) | [inline] |
Returns the time since last read/start without stopping the stopwatch (but resets the differential timer).
Definition at line 181 of file stopwatch.h.
References adv_stopwatch(), and running.
double stopw_base::last_time [protected] |
The last time we read/started/stopped the clock.
Definition at line 90 of file stopwatch.h.
Referenced by adv_stopwatch(), reset(), and start().
double stopw_base::total [protected] |
The total elapsed time since construction or reset.
Definition at line 92 of file stopwatch.h.
Referenced by adv_stopwatch(), read(), reset(), and stop().
const double stopw_base::secs_per_tick [protected] |
Used in seconds() to convert internal time to s.
Definition at line 94 of file stopwatch.h.
Referenced by adv_stopwatch(), stopwatch_us::seconds(), stopwatch_u::seconds(), and seconds().
const double stopw_base::overflow_secs [protected] |
If we overflow once, we miss this many seconds; We assume that internally long ints are used, i.e.
32bit counters on 32bit machines, 64bit on 64bit archs.
Definition at line 99 of file stopwatch.h.
Referenced by adv_stopwatch().
int stopw_base::running [protected] |
1.5.6