MeteoIODoc  MeteoIODoc-2.6.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mio::Timer Class Reference

Detailed Description

Time code execution with at least 1 us resolution. The time resolution can be stored up to .1 ns resolution, but is measured to the following accuracy:

Author
Tuan Anh Nguyen (original implementation in popc), Mathias Bavay (port and rewrite for Alpine3D and MeteoIO)
  • 1 us on Posix systems (Linux, osX, BSD);
  • 1 ns on Windows.

#include <Timer.h>

Public Member Functions

 Timer ()
 Default constructor. Initialize internal variables. It does NOT start timing. More...
 
void start ()
 Start the timer. More...
 
void restart ()
 Reset and start the timer. More...
 
void stop ()
 Stop the timer. It can be restarted afterward, adding time to what was already timed. More...
 
void reset ()
 Reset the timer to zero. More...
 
double getElapsed () const
 Get total elapsed time. It returns the sum of all the elapsed time between all the start/stop sessions since the timer was created or the last call to reset. Time is in seconds with microsecond resolution. More...
 

Protected Member Functions

long double getCurrentTime () const
 

Protected Attributes

long double start_point
 
double elapsed
 
bool isRunning
 

Constructor & Destructor Documentation

mio::Timer::Timer ( )

Default constructor. Initialize internal variables. It does NOT start timing.

Member Function Documentation

long double mio::Timer::getCurrentTime ( ) const
protected
double mio::Timer::getElapsed ( ) const

Get total elapsed time. It returns the sum of all the elapsed time between all the start/stop sessions since the timer was created or the last call to reset. Time is in seconds with microsecond resolution.

void mio::Timer::reset ( )

Reset the timer to zero.

void mio::Timer::restart ( )

Reset and start the timer.

void mio::Timer::start ( )

Start the timer.

void mio::Timer::stop ( )

Stop the timer. It can be restarted afterward, adding time to what was already timed.

Member Data Documentation

double mio::Timer::elapsed
protected
bool mio::Timer::isRunning
protected
long double mio::Timer::start_point
protected

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