Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

Timer Class Reference

#include <Util/Timer.H>

List of all members.


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.

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.
SimTime getSimTime () const
 Returns the elapsed SimTime since last reset.

Protected Attributes

int64 div
 time unit multipliers
int64 mul
timeval tv
 timestamp of last reset()


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 99 of file Timer.H.

References LFATAL, and reset().


Member Function Documentation

uint64 Timer::get  )  const [inline]
 

Return elapsed time.

Return value is the number of ticks since last reset or since construction.

Definition at line 112 of file Timer.H.

References div, mul, and tv.

Referenced by LandmarkDB::build(), SingleChannelBeoServer::check(), BeoSub::Decode(), SDLdisplay::displayYUVoverlay(), Beobot2GistSalMasterI::evolve(), BeoLRF::evolve(), BeoCamera::evolve(), extractBitObjects(), featureClusterVision< FLOAT >::fCVclusterImage(), featureClusterVision< FLOAT >::fCVrunStandAloneMSBatchFilter(), featureClusterVision< FLOAT >::fCVrunStandAloneMSBatchTest(), featureClusterVision< FLOAT >::fCVsaccadeTest(), featureClusterVision< FLOAT >::fCVstandAloneFeatureTest(), VisualObjectDB::getObjectMatches(), SDLdisplay::getTimerValue(), main(), NPclassify2< FLOAT >::NPclassifySpaceNew(), BeoSubPipe::pipeOrientation(), VirtualVoxel< T >::printTime(), VirtualVoxel< T >::printTimeConst(), BeobotVisualCortex::processEnd(), processLocalizerResults(), Staircase::pushEvent(), EventLog::pushEvent(), VirtualVoxel< T >::resetTime(), VirtualVoxel< T >::resetTimeConst(), IMU_MicroStrain_3DM_GX2::run(), GPS_USGlobalSat_EM_408::run(), CINNIC::RunSimpleImage(), speedRampFunc(), submain(), BeoSubQtMainForm::taskDecode(), BeobotControl::toSpeedLinear(), BeobotControl::toSpeedSigmoid(), Beobot2_GistSalLocalizerMasterI::updateMessage(), BeoLogger::updateMessage(), SDLdisplay::waitNextRequestedFrameTime(), and SDLdisplay::waitNextRequestedVsync().

uint64 Timer::getReset  )  [inline]
 

Return elapsed time since last reset, and reset.

Definition at line 120 of file Timer.H.

References div, mul, and tv.

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

double Timer::getSecs  )  const [inline]
 

Returns number of seconds since last reset.

Definition at line 134 of file Timer.H.

References tv.

Referenced by CMap_i::computeBiasCMAP(), CMap_i::computeCMAP(), CMap_i::computeCMAP2(), CMap_i::computeFlickerCMAP(), Scorbot::controlLoop(), RegSaliency::doInput(), CudaSaliency::doInput(), BeoPilot::evolve(), BeoSub::getTime(), main(), BeoSonar::plotDists(), BeoGPS::plotGPS(), Serial::readFrame(), Beowulf::receive(), run_master(), BeoSubOneBal::setBallasts(), submain(), test_lowpass5(), test_lowpass9(), BeoSubSim::updateCompass(), BeoSubOneBal::updateCompass(), BeoSubSim::updateDepth(), BeoSubOneBal::updateDepth(), updateDisplay(), BeoPilot::updateGUI(), SeaBee3Simulator::updateSensors(), and BeoSub::waitMove().

SimTime Timer::getSimTime  )  const [inline]
 

Returns the elapsed SimTime since last reset.

Definition at line 142 of file Timer.H.

References SimTime::SECS().

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

void Timer::reset  )  [inline]
 

Reset the timer and immediately start timing again.

Definition at line 108 of file Timer.H.

References tv.

Referenced by BeoCamera::BeoCamera(), BeoIMU::BeoIMU(), BeoLRF::BeoLRF(), LandmarkDB::build(), NPclassify::classifySpaceNew(), CMap_i::computeBiasCMAP(), CMap_i::computeCMAP(), CMap_i::computeCMAP2(), CMap_i::computeFlickerCMAP(), BeoSub::Decode(), RegSaliency::doInput(), CudaSaliency::doInput(), QT_Navigation::evolve(), Gist_Navigation::evolve(), Beobot2GistSalMasterI::evolve(), BeoLRF::evolve(), BeoIMU::evolve(), BeoCamera::evolve(), extractBitObjects(), featureClusterVision< FLOAT >::fCVclusterImage(), featureClusterVision< FLOAT >::fCVrunStandAloneMSBatchFilter(), featureClusterVision< FLOAT >::fCVrunStandAloneMSBatchTest(), featureClusterVision< FLOAT >::fCVsaccadeTest(), featureClusterVision< FLOAT >::fCVstandAloneFeatureTest(), BotControl::init(), main(), NPclassify2< FLOAT >::NPclassifySpaceNew(), BeoSubPipe::pipeOrientation(), BeoSonar::plotDists(), BeoGPS::plotGPS(), processLocalizerResults(), BeobotControl::rampSpeed(), Serial::readFrame(), Staircase::reset1(), Beowulf::resetConnections(), VirtualVoxel< T >::resetTime(), VirtualVoxel< T >::resetTimeConst(), IMU_MicroStrain_3DM_GX2::run(), GPS_USGlobalSat_EM_408::run(), RegSaliency::runSaliency(), CudaSaliency::runSaliency(), CINNIC::RunSimpleImage(), speedRampFunc(), Beobot2GistSalMasterI::start1(), BeoLogger::start1(), EventLog::start1(), Staircase::start2(), SDLdisplay::start2(), submain(), BeoSubQtMainForm::taskDecode(), test_lowpass5(), test_lowpass9(), Timer(), TrackFeature::TrackFeature(), BeoPilot::updateGUI(), BeoPilot::updateMessage(), SeaBee3Simulator::updateSensors(), and SDLdisplay::waitNextRequestedFrameTime().

int Timer::ticksPerSec  )  const [inline]
 

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

Definition at line 130 of file Timer.H.

References mul.

Referenced by main(), and MapperI::moveParticles().


Member Data Documentation

int64 Timer::div [protected]
 

time unit multipliers

Definition at line 90 of file Timer.H.

Referenced by get(), and getReset().

struct timeval Timer::tv [protected]
 

timestamp of last reset()

Definition at line 92 of file Timer.H.

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


The documentation for this class was generated from the following file:
Generated on Sat Nov 7 13:36:17 2009 for iLab Neuromorphic Vision Toolkit by  doxygen 1.4.4