chrono::ChTimer< seconds_type > Class Template Reference

Description

template<class seconds_type = double>
class chrono::ChTimer< seconds_type >

Class for high-resolution timing.

Use the start() ... stop() commands, then request the elapsed time between them using GetTimeMilliseconds() or GetTimeSeconds() etc. Note: the elapsed time is not computed at GetTime... functions, but only at stop(). If you use multiple start() ... stop() pairs, each time the duration is accumulated, until a reset() is done. Note: since the Windows std::chrono has a limited resolution (1ms-15ms depending on the system) here we temporary provide a conditional compilation of another timer that does not use std::chrono for windows, until Microsoft will provide a better std::chrono.

#include <ChTimer.h>

Public Member Functions

void start ()
 Start the timer.
 
void stop ()
 Stops the timer.
 
void reset ()
 Reset the total accumulated time (when repeating multiple start() stop() start() stop() )
 
unsigned long long GetTimeMilliseconds () const
 Returns the time in [ms]. More...
 
unsigned long long GetTimeMillisecondsIntermediate () const
 Returns the time in [ms] since start(). It does not require stop().
 
unsigned long long GetTimeMicroseconds () const
 Returns the time in [us]. More...
 
unsigned long long GetTimeMicrosecondsIntermediate () const
 Returns the time in [us] since start(). It does not require stop().
 
seconds_type GetTimeSeconds () const
 Returns the time in [s], with real_type precision Use start()..stop() before calling this.
 
seconds_type GetTimeSecondsIntermediate () const
 Returns the time in [s] since start(). It does not require stop().
 
seconds_type operator() () const
 Get the last timer value, in seconds, with the () operator.
 

Member Function Documentation

◆ GetTimeMicroseconds()

template<class seconds_type = double>
unsigned long long chrono::ChTimer< seconds_type >::GetTimeMicroseconds ( ) const
inline

Returns the time in [us].

Use start()..stop() before calling this.

◆ GetTimeMilliseconds()

template<class seconds_type = double>
unsigned long long chrono::ChTimer< seconds_type >::GetTimeMilliseconds ( ) const
inline

Returns the time in [ms].

Use start()..stop() before calling this.


The documentation for this class was generated from the following file:
  • /builds/uwsbel/chrono/src/chrono/core/ChTimer.h