
#include <Util/Timer.H>
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; immediately start timing.
|
|
|
|
Return elapsed time since last reset, and reset.
Definition at line 120 of file Timer.H. Referenced by TrackFeature::calcFps(), BotControl::getImageSensor(), main(), and MapperI::updateMessage(). |
|
|
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(). |
|
|
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(). |
|
|
|
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(). |
|
|
time unit multipliers
Definition at line 90 of file Timer.H. Referenced by get(), and getReset(). |
|
|
timestamp of last reset()
Definition at line 92 of file Timer.H. Referenced by get(), getReset(), getSecs(), and reset(). |
1.4.4