Public Member Functions | Static Public Member Functions | Private Attributes
UTimer Class Reference

#include <UTimer.h>

List of all members.

Public Member Functions

double elapsed ()
double getElapsedTime ()
double restart ()
void start ()
void stop ()
double ticks ()
 UTILITE_DEPRECATED (double getInterval())
 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:

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

Definition at line 46 of file UTimer.h.


Constructor & Destructor Documentation

Definition at line 26 of file UTimer.cpp.

Definition at line 34 of file UTimer.cpp.


Member Function Documentation

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.

Definition at line 90 of file UTimer.cpp.

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 73 of file UTimer.cpp.

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.

void UTimer::start ( )

This method starts the timer.

Definition at line 80 of file UTimer.cpp.

void UTimer::stop ( )

This method stops the timer.

Definition at line 85 of file UTimer.cpp.

double UTimer::ticks ( )

Definition at line 110 of file UTimer.cpp.

UTimer::UTILITE_DEPRECATED ( double   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.

Member Data Documentation

struct timeval UTimer::startTimeRecorded_ [private]

Definition at line 104 of file UTimer.h.

struct timeval UTimer::stopTimeRecorded_ [private]

Definition at line 105 of file UTimer.h.


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


rtabmap
Author(s): Mathieu Labbe
autogenerated on Sat Jul 23 2016 11:44:31