Public Member Functions | Private Attributes | List of all members
Timer Class Reference

A timer object to measure elapsed time. More...

#include <Timer.hpp>

Public Member Functions

TimeDuration elapsed () const
 
UINT32 elapsedMicroseconds () const
 Returns the elapsed time in microseconds since the timer was started or restarted. More...
 
UINT32 elapsedMicrosecondsSinceLastCall ()
 Elapsed us since the last call of this function. More...
 
UINT32 elapsedMilliseconds () const
 Returns the elapsed time in milliseconds since the timer was started or restarted. More...
 
UINT32 elapsedMillisecondsSinceLastCall ()
 Elapsed ms since the last call of this function. More...
 
bool isElapsed ()
 
void reset ()
 
void restart ()
 Restarts the timer. More...
 
void startWatchdog (TimeDuration watchdogTime)
 
 Timer ()
 Constructor. More...
 
virtual ~Timer ()
 Destructor. More...
 

Private Attributes

Time m_startTime
 
TimeDuration m_watchdogTime
 

Detailed Description

A timer object to measure elapsed time.

This class is intended for simple timing diagnostics during debug phase. For a more accurate profiling of your code use a profiler like valgrind or similar.

Due to accuracy differences on various platforms for Windows PCs and Linux PCs implementations and accuracy may differ.

Definition at line 24 of file Timer.hpp.

Constructor & Destructor Documentation

Timer::Timer ( )

Constructor.

The timer is started, with the construction of an instance.

Definition at line 11 of file Timer.cpp.

Timer::~Timer ( )
virtual

Destructor.

Definition at line 16 of file Timer.cpp.

Member Function Documentation

TimeDuration Timer::elapsed ( ) const

"Jetzt" Elapsed time since last start or restart, in [s].

Definition at line 78 of file Timer.cpp.

UINT32 Timer::elapsedMicroseconds ( ) const

Returns the elapsed time in microseconds since the timer was started or restarted.

Elapsed time since last restart, in [us]

Definition at line 105 of file Timer.cpp.

UINT32 Timer::elapsedMicrosecondsSinceLastCall ( )

Elapsed us since the last call of this function.

Documentation see "elapsedMillisecondsSinceLastCall()", but it measures microseconds instead.

Definition at line 141 of file Timer.cpp.

UINT32 Timer::elapsedMilliseconds ( ) const

Returns the elapsed time in milliseconds since the timer was started or restarted.

Elapsed time since last restart, in [ms]

Definition at line 95 of file Timer.cpp.

UINT32 Timer::elapsedMillisecondsSinceLastCall ( )

Elapsed ms since the last call of this function.

Elapsed time since last call to this function, in [ms]. This function may be called without restarts as it measures the time between consecutive calls to this function. Usage:

    t;
    // ...
    t.elapsedMillisecondsSinceLastCall();
    // ... functions to be timed ...
    UINT32 time1 = t.elapsedMillisecondsSinceLastCall();
    // ... next functions to be timed ...
    UINT32 time2 = t.elapsedMillisecondsSinceLastCall();
 // ...

Thats it!

Definition at line 130 of file Timer.cpp.

bool Timer::isElapsed ( )

Definition at line 32 of file Timer.cpp.

void Timer::reset ( )

Definition at line 48 of file Timer.cpp.

void Timer::restart ( )

Restarts the timer.

Definition at line 56 of file Timer.cpp.

void Timer::startWatchdog ( TimeDuration  watchdogTime)

Definition at line 23 of file Timer.cpp.

Member Data Documentation

Time Timer::m_startTime
private

Definition at line 64 of file Timer.hpp.

TimeDuration Timer::m_watchdogTime
private

Definition at line 65 of file Timer.hpp.


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


libsick_ldmrs
Author(s): SICK AG , Martin Günther , Jochen Sprickerhof
autogenerated on Mon Oct 26 2020 03:27:30