DGtal  1.5.beta
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
 internal timer object; More...

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

◆ Clock()

DGtal::Clock::Clock ( )


◆ ~Clock()

DGtal::Clock::~Clock ( )


Member Function Documentation

◆ isValid()

bool DGtal::Clock::isValid ( ) const

Checks the validity/consistency of the object.

'true' if the object is valid, 'false' otherwise.

◆ restartClock()

double DGtal::Clock::restartClock ( )

Restart the clock.

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

Referenced by test_RestartClock().

◆ selfDisplay()

void DGtal::Clock::selfDisplay ( std::ostream &  out) const

Writes/Displays the object on an output stream.

outthe output stream where the object is written.

◆ startClock()

void DGtal::Clock::startClock ( )

Starts a clock.

Referenced by SCENARIO(), test_loopTick(), test_MultipleLoop(), and test_RestartClock().

◆ stopClock()

double DGtal::Clock::stopClock ( ) const

Stops the clock.

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

Referenced by test_MultipleLoop(), and test_RestartClock().

Field Documentation

◆ myTimerStart

struct timespec DGtal::Clock::myTimerStart

internal timer object;

Definition at line 141 of file Clock.h.

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