CLUtils  0.2.1
 Hosted by GitHub
Public Member Functions | List of all members
clutils::CPUTimer< rep, period > Class Template Reference

A class for measuring execution times. More...

#include <CLUtils.hpp>

Public Member Functions

 CPUTimer (int initVal=0)
 Constructs a timer. More...
 
void start (bool tReset=true)
 Starts the timer. More...
 
rep stop ()
 Stops the timer. More...
 
rep duration ()
 Returns the time measured by the timer. More...
 
void reset ()
 Resets the timer.
 

Detailed Description

template<typename rep = int64_t, typename period = std::milli>
class clutils::CPUTimer< rep, period >

A class for measuring execution times.

CPUTimer is an interface for std::chrono::duration.

Template Parameters
repthe type of the value returned by duration.
periodthe unit of time for the value returned by duration. It is declared as an std::ratio<std::intmax_t num, std::intmax_t den>.

Constructor & Destructor Documentation

template<typename rep = int64_t, typename period = std::milli>
clutils::CPUTimer< rep, period >::CPUTimer ( int  initVal = 0)
inline

Constructs a timer.

The timer doesn't start automatically.

Parameters
[in]initVala value to initialize the timer with.

Member Function Documentation

template<typename rep = int64_t, typename period = std::milli>
rep clutils::CPUTimer< rep, period >::duration ( )
inline

Returns the time measured by the timer.

This time is measured up to the point the timer last time stopped.

Returns
The time in period units.
template<typename rep = int64_t, typename period = std::milli>
void clutils::CPUTimer< rep, period >::start ( bool  tReset = true)
inline

Starts the timer.

Parameters
[in]tReseta flag for resetting the timer before the timer starts. If false, the timer starts counting from the point it reached the last time it stopped.
template<typename rep = int64_t, typename period = std::milli>
rep clutils::CPUTimer< rep, period >::stop ( )
inline

Stops the timer.

Returns
The time measured up to this point in period units.

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