Public Member Functions | Private Member Functions | Private Attributes

DGtal::Clock Class Reference

#include <Clock.h>

Public Member Functions

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

Private Member Functions

 Clock (const Clock &other)
Clockoperator= (const Clock &other)

Private Attributes

struct itimerval myTimerInit

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/utils/Clock.h>

   Clock c;
   long duration;

   c.startClock();
   ...
   //do something
   ...
   duration = c.stopClock();

   std::cout<< "Duration in ms. : "<< duration <<endl;
See also:
testClock.cpp

Constructor & Destructor Documentation

DGtal::Clock::Clock (  ) 

Constructor.

DGtal::Clock::~Clock (  ) 

Destructor.

DGtal::Clock::Clock ( const Clock other  )  [private]

Copy constructor.

Parameters:
other the object to clone. Forbidden by default.

Member Function Documentation

bool DGtal::Clock::isValid (  )  const

Checks the validity/consistency of the object.

Returns:
'true' if the object is valid, 'false' otherwise.
Clock& DGtal::Clock::operator= ( const Clock other  )  [private]

Assignment.

Parameters:
other the object to copy.
Returns:
a reference on 'this'. Forbidden by default.
void DGtal::Clock::selfDisplay ( std::ostream &  out  )  const

Writes/Displays the object on an output stream.

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

Starts a clock.

Referenced by test_loopTick(), test_minimalTick(), and test_MultipleLoop().

long DGtal::Clock::stopClock (  ) 

Stops the clock.

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

Referenced by test_loopTick(), test_minimalTick(), and test_MultipleLoop().


Field Documentation

struct itimerval DGtal::Clock::myTimerInit [private]

internal timer object;


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