DGtal  0.9.4beta
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;
c.startClock();
...
//do something
...
duration = c.stopClock();
std::cout<< "Duration in ms. : "<< duration <<endl;
See also
testClock.cpp

Definition at line 95 of file Clock.h.

Constructor & Destructor Documentation

DGtal::Clock::Clock ( )

Constructor.

DGtal::Clock::~Clock ( )

Destructor.

Member Function Documentation

bool DGtal::Clock::isValid ( ) const

Checks the validity/consistency of the object.

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

Restart the clock.

Returns
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.

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

Starts a clock.

double DGtal::Clock::stopClock ( ) const

Stops the clock.

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

Field Documentation

struct timespec DGtal::Clock::myTimerStart
private

internal timer object;

Definition at line 150 of file Clock.h.


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