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

#include <UTimer.h>

Public Member Functions

double elapsed ()
 
double getElapsedTime ()
 
UTILITE_DEPRECATED double getInterval ()
 
double restart ()
 
void start ()
 
void stop ()
 
double ticks ()
 
 UTimer ()
 
 ~UTimer ()
 

Static Public Member Functions

static double now ()
 

Private Attributes

struct timeval startTimeRecorded_
 
struct timeval stopTimeRecorded_
 

Detailed Description

This class is used to time some codes (in seconds). On Unix, the resolution is up to microseconds (see gettimeofday()). On Windows, the performance counter is used (see QueryPerformanceCounter() and QueryPerformanceFrequency()). Example:

timer.start();
... (do some work)
timer.stop();
double seconds = timer.getInterval();
...

Definition at line 46 of file UTimer.h.

Constructor & Destructor Documentation

◆ UTimer()

UTimer::UTimer ( )

Definition at line 26 of file UTimer.cpp.

◆ ~UTimer()

UTimer::~UTimer ( )

Definition at line 34 of file UTimer.cpp.

Member Function Documentation

◆ elapsed()

double UTimer::elapsed ( )
inline

This method is used to get the elapsed time between now and the start(). If timer is stopped, the interval time between stop() and the start() is returned.

Returns
double the interval in seconds.

Definition at line 75 of file UTimer.h.

◆ getElapsedTime()

double UTimer::getElapsedTime ( )

Definition at line 97 of file UTimer.cpp.

◆ getInterval()

double UTimer::getInterval ( )

This method is used to get the interval time between stop() and the start().

Returns
double the interval in seconds.
Deprecated:
use elapsed() instead.

Definition at line 102 of file UTimer.cpp.

◆ now()

double UTimer::now ( )
static

This method is used to get the time of the system right now.

Returns
double the time in seconds.

Definition at line 80 of file UTimer.cpp.

◆ restart()

double UTimer::restart ( )
inline

This method is used to get the interval of the timer while it is running. It's automatically stop the timer, get the interval and restart the timer. It's the same of calling stop(), elapsed() and start(). Method restart() does the same thing, for convenience.

Returns
double the interval in seconds.

Definition at line 94 of file UTimer.h.

◆ start()

void UTimer::start ( )

This method starts the timer.

Definition at line 87 of file UTimer.cpp.

◆ stop()

void UTimer::stop ( )

This method stops the timer.

Definition at line 92 of file UTimer.cpp.

◆ ticks()

double UTimer::ticks ( )

Definition at line 117 of file UTimer.cpp.

Member Data Documentation

◆ startTimeRecorded_

struct timeval UTimer::startTimeRecorded_
private

Definition at line 104 of file UTimer.h.

◆ stopTimeRecorded_

struct timeval UTimer::stopTimeRecorded_
private

Definition at line 105 of file UTimer.h.


The documentation for this class was generated from the following files:
timer
UTimer
Definition: UTimer.h:46


rtabmap
Author(s): Mathieu Labbe
autogenerated on Thu Jul 25 2024 02:50:26