DGtal  0.9.3beta
Public Member Functions | Private Attributes
DGtal::Clock Class Reference

#include <DGtal/base/Clock.h>

Public Member Functions

void startClock ()
double stopClock () const
double restartClock ()
 Clock ()
 ~Clock ()
void selfDisplay (std::ostream &out) const
bool isValid () const

Private Attributes

struct timespec myTimerStart

Detailed Description

Description of class 'Clock'

Aim: To provide functions to start and stop a timer. Is useful to get performance of algorithms.

The following code snippet demonstrates how to use Clock

#include <DGtal/base/Clock.h>
Clock c;
long duration;
//do something
duration = c.stopClock();
std::cout<< "Duration in ms. : "<< duration <<endl;
See also

Definition at line 95 of file Clock.h.

Constructor & Destructor Documentation

DGtal::Clock::Clock ( )


DGtal::Clock::~Clock ( )


Member Function Documentation

bool DGtal::Clock::isValid ( ) const

Checks the validity/consistency of the object.

'true' if the object is valid, 'false' otherwise.
double DGtal::Clock::restartClock ( )

Restart the clock.

the time (in ms) since the last 'startClock()' or 'restartClock()'.
void DGtal::Clock::selfDisplay ( std::ostream &  out) const

Writes/Displays the object on an output stream.

outthe output stream where the object is written.
void DGtal::Clock::startClock ( )

Starts a clock.

double DGtal::Clock::stopClock ( ) const

Stops the clock.

the time (in ms) since the last 'startClock()' or 'restartClock()'.

Field Documentation

struct timespec DGtal::Clock::myTimerStart

internal timer object;

Definition at line 150 of file Clock.h.

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