8 #ifndef INCL_evo_timer_h 9 #define INCL_evo_timer_h 55 template<
class T=TimerStampWall>
62 memset(
this, 0,
sizeof(This));
69 memcpy(
this, &src,
sizeof(This));
77 memcpy(
this, &src,
sizeof(This));
83 memset(
this, 0,
sizeof(This));
154 elapsed_ = elapsed();
164 ulongl elapsed()
const {
165 ulongl
nsec = elapsed_;
169 nsec += end.diff_nsec(start_);
ulongl nsec() const
Get current time elapsed in nanoseconds.
Definition: timer.h:125
Evo system time implementation helpers.
This & stop()
Stop timer.
Definition: timer.h:153
Timer that works like a stopwatch.
Definition: timer.h:56
This & operator=(const This &src)
Assignment/Copy operator.
Definition: timer.h:76
void set_wall_timer()
Set as current real (wall clock) time for use by timers.
Definition: systime.h:392
#define EVO_ONCPP11(EXPR)
Compile EXPR only if C++11 support is detected, otherwise this is a no-op.
Definition: sys.h:259
TimerT()
Constructor.
Definition: timer.h:61
Holds a CPU (process) timer-stamp, used as template argument with TimerT.
Definition: timer.h:38
ulongl msec() const
Get current time elapsed in milliseconds.
Definition: timer.h:107
Holds a real (wall clock) timer-stamp, used as template argument with TimerT.
Definition: timer.h:24
void resume()
Resume timer from last stop.
Definition: timer.h:144
TimerT(const This &src)
Copy constructor.
Definition: timer.h:68
TimerT< T > This
This type.
Definition: timer.h:58
Evo C++ Library namespace.
Definition: alg.h:11
double sec() const
Get current time elapsed in floating-point seconds (with fraction).
Definition: timer.h:98
ulongl usec() const
Get current time elapsed in microseconds.
Definition: timer.h:116
TimerT< TimerStampCpu > TimerCpu
Timer that works like a stopwatch and measures CPU (process) time.
Definition: timer.h:225
static const ulong NSEC_PER_USEC
Nanoseconds per microsecond.
Definition: systime.h:274
TimerT< TimerStampWall > Timer
Timer that works like a stopwatch and measures real (wall clock) time.
Definition: timer.h:200
void clear()
Stop and clear timer.
Definition: timer.h:82
bool active() const
Get whether timer is active (started).
Definition: timer.h:89
Holds a system timestamp for storing date/time and measuring elapsed time.
Definition: systime.h:269
static const ulong NSEC_PER_SEC
Nanoseconds per second.
Definition: systime.h:270
void start()
Start timer.
Definition: timer.h:133
static const ulong NSEC_PER_MSEC
Nanoseconds per millisecond.
Definition: systime.h:273
ulong nsec
Number of nanoseconds from seconds.
Definition: systime.h:284