MercuryDPM  Alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Time Class Reference

Allows for timing the algorithms; accurate up to 0.01 sec. More...

#include <MercuryTime.h>

Public Member Functions

void tic ()
 This is like a start button of a stopwatch. Assigns the variable start with the current number of clock ticks. More...
 
Mdouble toc ()
 This is like a stop button of a stopwatch. Assigns the variable finish to the current value of ticks returned by clock(). More...
 

Private Attributes

clock_t start
 Stores the number of clock ticks, called by Time::tic(). More...
 
clock_t finish
 Stores the number of clock ticks, called by Time::toc(). More...
 

Detailed Description

Allows for timing the algorithms; accurate up to 0.01 sec.

Calculates the amount of computational time used, in seconds. Works on the same concept of stopwatch, where one presses start and stops when needed. The difference returns the total time used up.

Definition at line 40 of file MercuryTime.h.

Member Function Documentation

void Time::tic ( )
inline

This is like a start button of a stopwatch. Assigns the variable start with the current number of clock ticks.

Definition at line 48 of file MercuryTime.h.

References start.

49  {
50  start = clock(); //clock tics
51  }
clock_t start
Stores the number of clock ticks, called by Time::tic().
Definition: MercuryTime.h:68
Mdouble Time::toc ( )
inline

This is like a stop button of a stopwatch. Assigns the variable finish to the current value of ticks returned by clock().

Returns
However, it also returns the total real time in seconds.

Definition at line 58 of file MercuryTime.h.

References finish, and start.

59  {
60  finish = clock();
61  return (Mdouble(finish) - Mdouble(start)) / CLOCKS_PER_SEC;
62  }
clock_t start
Stores the number of clock ticks, called by Time::tic().
Definition: MercuryTime.h:68
double Mdouble
clock_t finish
Stores the number of clock ticks, called by Time::toc().
Definition: MercuryTime.h:73

Member Data Documentation

clock_t Time::finish
private

Stores the number of clock ticks, called by Time::toc().

Definition at line 73 of file MercuryTime.h.

Referenced by toc().

clock_t Time::start
private

Stores the number of clock ticks, called by Time::tic().

Definition at line 68 of file MercuryTime.h.

Referenced by tic(), and toc().


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