Gaia
gaia2::Timer Class Reference

This class allows you to measure a certain amount of time, for instance if you want to know how long the execution of a given function takes. More...

#include <timer.h>

Public Member Functions

 Timer ()
 The constructor of the class.
 
void start ()
 Starts the timer. More...
 
void restart ()
 Restarts the timer. More...
 
void stop ()
 Stops the timer.
 
void reset ()
 Reset the total to 0.
 
double elapsed () const
 Returns the cumulative number of seconds elapsed between each call to the start()/stop() pair. More...
 

Detailed Description

This class allows you to measure a certain amount of time, for instance if you want to know how long the execution of a given function takes.

Its use is very easy: you create the object, you start it, you stop it, and then you ask it how much time there was between the start and stop calls. You can start it and stop it multiple times; in this case, the result will be the sum of each lapse of time.

Member Function Documentation

double Timer::elapsed ( ) const

Returns the cumulative number of seconds elapsed between each call to the start()/stop() pair.

If you didn't call one of these two functions at least once or if the timer is still running, this functions returns 0.

Returns
the number of elapsed seconds between start() and stop(), 0 if an error has occured.

Referenced by gaia2::BaseView< DataSetType, PointType, SearchPointType, DistanceType >::getSearchSpace(), gaia2::BaseView< DataSetType, PointType, SearchPointType, DistanceType >::nnSearch(), restart(), and gaia2::BaseView< DataSetType, PointType, SearchPointType, DistanceType >::validate().

void gaia2::Timer::restart ( )
inline

Restarts the timer.

Has same effect as reset() followed by start() Total is reset to 0.

References elapsed(), reset(), start(), stop(), and Timer().

Referenced by gaia2::BaseView< DataSetType, PointType, SearchPointType, DistanceType >::nnSearch().


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