Euclid
Geometry Processing and Shape Analysis in C++
Euclid::Timer Class Reference

A simple timer.

#include <Timer.h>

Public Member Functions

void tick ()
 Start the timer. More...
 
template<typename Rep = double, typename Period = std::ratio<1>>
Rep tock ()
 Stop the timer and return the elapsed time. More...
 

Member Function Documentation

void Euclid::Timer::tick ( )
inline

The timer is reset when tick is called.

template<typename Rep = double, typename Period = std::ratio<1>>
Rep Euclid::Timer::tock ( )
inline

You could control the representation and precesion of the timer using the template arguments. The default is to count seconds in double format, like 3.14159 seconds. You could use, for example, tock<int, std::milli>() to return integer valued milliseconds. See std::chrono for detailed explainations of these parameters. If tick is not called, tock will return 0.

Template Parameters
RepThe representational type of the elapsed time, default to double.
PeriodThe unit of the elapsed time, default to second.

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