Quantum++  v0.6
C++11 quantum computing library
qpp::Timer Class Reference

Measures time. More...

#include <classes/timer.h>

Public Member Functions

 Timer () noexcept
 Constructs an instance with the current time as the starting point. More...
 
void tic () noexcept
 Resets the chronometer. More...
 
const Timertoc () noexcept
 Stops the chronometer. More...
 
double seconds () const noexcept
 Time passed in seconds. More...
 

Protected Attributes

std::chrono::steady_clock::time_point _start
 
std::chrono::steady_clock::time_point _end
 

Friends

template<typename charT , typename traits >
std::basic_ostream< charT, traits > & operator<< (std::basic_ostream< charT, traits > &os, const Timer &rhs)
 Overload for std::ostream operators. More...
 

Detailed Description

Measures time.

Uses a std::chrono::steady_clock. It is not affected by wall clock changes during runtime.

Constructor & Destructor Documentation

qpp::Timer::Timer ( )
inlinenoexcept

Constructs an instance with the current time as the starting point.

Member Function Documentation

double qpp::Timer::seconds ( ) const
inlinenoexcept

Time passed in seconds.

Returns
Number of seconds that passed between the instantiation/reset and invocation of qpp::Timer::toc()
void qpp::Timer::tic ( )
inlinenoexcept

Resets the chronometer.

Resets the starting/ending point to the current time

const Timer& qpp::Timer::toc ( )
inlinenoexcept

Stops the chronometer.

Set the current time as the ending point

Returns
Current instance

Friends And Related Function Documentation

template<typename charT , typename traits >
std::basic_ostream<charT, traits>& operator<< ( std::basic_ostream< charT, traits > &  os,
const Timer rhs 
)
friend

Overload for std::ostream operators.

Parameters
osOutput stream
rhsTimer instance
Returns
Writes to the output stream the number of seconds that passed between the instantiation/reset and invocation of qpp::Timer::toc().

Member Data Documentation

std::chrono::steady_clock::time_point qpp::Timer::_end
protected
std::chrono::steady_clock::time_point qpp::Timer::_start
protected

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