HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ScopedTimer Class Reference

#include <Timer.h>

Public Types

using clock = std::chrono::high_resolution_clock
 

Public Member Functions

 ScopedTimer (double *externalCounter=nullptr)
 
 ~ScopedTimer ()
 
double elapsedTime ()
 Return the elapsed time in seconds since our start time. More...
 
void startTimer ()
 Activate the timer, and set our start time to the current moment. More...
 
void endTimer ()
 Deactivate the timer, and add the elapsed time to our external counter. More...
 
 ScopedTimer (Timer &t)
 
 ~ScopedTimer ()
 
void start ()
 
void stop ()
 
void reset ()
 

Protected Attributes

bool _active
 
double * _externalCounter
 
std::chrono::time_point< clock_startTime
 

Detailed Description

Helper class that starts and stops a timer when the ScopedTimer goes in and out of scope.

A class for scoped event timing

Definition at line 20 of file Timer.h.

Member Typedef Documentation

using ScopedTimer::clock = std::chrono::high_resolution_clock

Definition at line 23 of file Timer.h.

Constructor & Destructor Documentation

ScopedTimer::ScopedTimer ( double *  externalCounter = nullptr)
ScopedTimer::~ScopedTimer ( )
ScopedTimer::ScopedTimer ( Timer t)
inline

Given a reference to a timer, start it when this constructor occurs.

Definition at line 240 of file timer.h.

ScopedTimer::~ScopedTimer ( )
inline

Stop the timer from ticking when this object is destroyed (i.e. it leaves scope).

Definition at line 248 of file timer.h.

Member Function Documentation

double ScopedTimer::elapsedTime ( )

Return the elapsed time in seconds since our start time.

void ScopedTimer::endTimer ( )

Deactivate the timer, and add the elapsed time to our external counter.

void ScopedTimer::reset ( void  )
inline

Explicit reset of the timer.

Definition at line 260 of file timer.h.

void ScopedTimer::start ( )
inline

Explicit start of the timer.

Definition at line 252 of file timer.h.

void ScopedTimer::startTimer ( )

Activate the timer, and set our start time to the current moment.

void ScopedTimer::stop ( )
inline

Explicit stop of the timer.

Definition at line 256 of file timer.h.

Member Data Documentation

bool ScopedTimer::_active
protected

Definition at line 38 of file Timer.h.

double* ScopedTimer::_externalCounter
protected

Definition at line 39 of file Timer.h.

std::chrono::time_point<clock> ScopedTimer::_startTime
protected

Definition at line 40 of file Timer.h.


The documentation for this class was generated from the following file: