Timer Class Reference

This class implements a real-time timer. More...

#include <Util/Timer.H>

Collaboration diagram for Timer:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Timer (const int tickspersec=1000)
 Constructor; immediately start timing.
void reset ()
 Reset the timer and immediately start timing again.
uint64 get () const
 Return elapsed time.
uint64 getReset ()
 Return elapsed time since last reset, and reset.
int ticksPerSec () const
 Returns number of ticks per second, as specified at construction.
double getSecs () const
 Returns number of seconds since last reset.
double getMilliSecs () const
 Returns number of milliseconds since last reset.
SimTime getSimTime () const
 Returns the elapsed SimTime since last reset.
void pause ()
 Pause the timer.
void resume ()
 Resume the timer.

Protected Attributes

int64 div
 time unit multipliers
int64 mul
struct timeval tv
 timestamp of last reset()
int64 offset
 timer offset of pause()/resume()
bool pauseFlag

Detailed Description

This class implements a real-time timer.

Timing starts at construction or reset().

At construction, you can decide on a number of timer ticks per second; use 1000 to count in milliseconds, 1000000 to count in microseconds, etc. The best resolution achievable is 1us, as this timer relies on the gettimeofday() system call, which has microsecond resolution. Use get() to measure the number of elapsed ticks since last reset(), or getSecs() to get the fractional number of seconds. Use ticksPerSec() to retrieve this value, for example to convert yourself your measured times back to seconds instead of using getSecs().

Definition at line 58 of file Timer.H.


Constructor & Destructor Documentation

Timer::Timer ( const int  tickspersec = 1000  )  [inline]

Constructor; immediately start timing.

Parameters:
tickspersec number of timer ticks per second; use 1000 to count in milliseconds, 1000000 to count in microseconds, etc. Values larger than 1000000 will throw a fatal error. If 1000000/tickspersec is not integer, a fatal error will also occur.

Definition at line 111 of file Timer.H.

References reset().


Member Function Documentation

uint64 Timer::get (  )  const [inline]
double Timer::getMilliSecs (  )  const [inline]

Returns number of milliseconds since last reset.

Definition at line 160 of file Timer.H.

References tv.

uint64 Timer::getReset (  )  [inline]

Return elapsed time since last reset, and reset.

Definition at line 138 of file Timer.H.

References div, and tv.

Referenced by BotControl::getImageSensor(), main(), and MapperI::updateMessage().

double Timer::getSecs (  )  const [inline]
SimTime Timer::getSimTime (  )  const [inline]

Returns the elapsed SimTime since last reset.

Definition at line 168 of file Timer.H.

References getSecs(), and SimTime::SECS().

Referenced by BeoSub::getSaliencyMap(), and main().

void Timer::pause (  )  [inline]

Pause the timer.

Definition at line 174 of file Timer.H.

References offset.

Referenced by BeoPilot::evolve().

void Timer::reset ( void   )  [inline]

Reset the timer and immediately start timing again.

Definition at line 120 of file Timer.H.

References offset, and tv.

Referenced by LandmarkDB::build(), NPclassify::classifySpaceNew(), RegSaliency::doInput(), FaceDetector::evolve(), QT_Navigation::evolve(), SeaBee3GUIIce::evolve(), CornerNavigation::evolve(), BeoLRF::evolve(), Beobot2GistSalMasterI::evolve(), BeoCamera::evolve(), GistSal_Navigation::evolve(), BeoIMU::evolve(), BeoPilot::evolve(), Gist_Navigation::evolve(), extractBitObjects(), featureClusterVision< FLOAT >::fCVclusterImage(), featureClusterVision< FLOAT >::fCVrunStandAloneMSBatchFilter(), featureClusterVision< FLOAT >::fCVrunStandAloneMSBatchTest(), featureClusterVision< FLOAT >::fCVsaccadeTest(), featureClusterVision< FLOAT >::fCVstandAloneFeatureTest(), CudaHmaxFL::getC2(), getData(), FoeDetector::getFoe(), BotControl::init(), Environment::load(), BeoPilot::loadFromLogFile(), main(), NPclassify2< FLOAT >::NPclassifySpaceNew(), processLocalizerResults(), BeobotControl::rampSpeed(), Serial::readFrame(), Staircase::reset1(), Beowulf::resetConnections(), IMU_MicroStrain_3DM_GX2::run(), CudaSaliency::runSaliency(), RegSaliency::runSaliency(), CINNIC::RunSimpleImage(), Beobot2GistSalMasterI::start1(), BeoLogger::start1(), FaceDetector::start1(), EventLog::start1(), GistSal_Grapher::start1(), SDLdisplay::start2(), Staircase::start2(), Timer(), WaypointControllerI::updateMessage(), VisionBrainComponentI::updateMessage(), BeoPilot::updateMessage(), and SDLdisplay::waitNextRequestedFrameTime().

void Timer::resume (  )  [inline]

Resume the timer.

Definition at line 182 of file Timer.H.

References tv.

Referenced by BeoPilot::evolve().

int Timer::ticksPerSec (  )  const [inline]

Returns number of ticks per second, as specified at construction.

Definition at line 148 of file Timer.H.


Member Data Documentation

int64 Timer::div [protected]

time unit multipliers

Definition at line 99 of file Timer.H.

Referenced by get(), and getReset().

int64 Timer::offset [protected]

timer offset of pause()/resume()

Definition at line 103 of file Timer.H.

Referenced by get(), pause(), and reset().

struct timeval Timer::tv [protected]

timestamp of last reset()

Definition at line 101 of file Timer.H.

Referenced by get(), getMilliSecs(), getReset(), getSecs(), reset(), and resume().


The documentation for this class was generated from the following file:
Generated on Sun May 8 08:43:50 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3