ra4_draw  4bd0201e3d922d42bd545d4b045ed44db33454a4
Public Types | Public Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
Timer Class Reference

#include <timer.hpp>

Public Types

using Clock = std::chrono::high_resolution_clock
 
using TimeType = Clock::time_point
 

Public Member Functions

 Timer (std::size_t num_iterations=0, double auto_print=-1., bool erase_lines=false)
 
 Timer (std::size_t num_iterations, std::chrono::duration< double > auto_print, bool erase_lines=false)
 
 Timer (const std::string &label, std::size_t num_iterations=0, double auto_print=-1., bool erase_lines=false)
 
 Timer (const std::string &label, std::size_t num_iterations, std::chrono::duration< double > auto_print, bool erase_lines=false)
 
 Timer (const Timer &)=default
 
Timeroperator= (const Timer &)=default
 
 Timer (Timer &&)=default
 
Timeroperator= (Timer &&)=default
 
 ~Timer ()=default
 
void Iterate ()
 
void Restart ()
 
void Restart (std::size_t num_iterations)
 
std::chrono::duration< double > ElapsedTime () const
 
std::chrono::duration< double > RemainingTime () const
 
std::size_t Iteration () const
 
TimerIteration (size_t iteration)
 
std::size_t NumIterations () const
 
TimerNumIterations (std::size_t num_iterations)
 
std::chrono::duration< double > AutoPrintTime () const
 
TimerAutoPrintTime (double auto_print)
 
TimerAutoPrintTime (std::chrono::duration< double > auto_print)
 
const std::string & Label () const
 
TimerLabel (const std::string &label)
 

Private Attributes

std::string label_
 
TimeType start_time_
 
TimeType last_print_
 
std::size_t iteration_
 
std::size_t num_iterations_
 
std::chrono::duration< double > auto_print_
 
bool erase_lines_
 

Static Private Attributes

static std::mutex mutex_ {}
 

Friends

std::ostream & operator<< (std::ostream &stream, const Timer &timer)
 

Detailed Description

Definition at line 9 of file timer.hpp.

Member Typedef Documentation

using Timer::Clock = std::chrono::high_resolution_clock

Definition at line 11 of file timer.hpp.

using Timer::TimeType = Clock::time_point

Definition at line 12 of file timer.hpp.

Constructor & Destructor Documentation

Timer::Timer ( std::size_t  num_iterations = 0,
double  auto_print = -1.,
bool  erase_lines = false 
)
explicit
Timer::Timer ( std::size_t  num_iterations,
std::chrono::duration< double >  auto_print,
bool  erase_lines = false 
)
Timer::Timer ( const std::string &  label,
std::size_t  num_iterations = 0,
double  auto_print = -1.,
bool  erase_lines = false 
)
explicit
Timer::Timer ( const std::string &  label,
std::size_t  num_iterations,
std::chrono::duration< double >  auto_print,
bool  erase_lines = false 
)
Timer::Timer ( const Timer )
default
Timer::Timer ( Timer &&  )
default
Timer::~Timer ( )
default

Member Function Documentation

chrono::duration< double > Timer::AutoPrintTime ( ) const

Definition at line 165 of file timer.cpp.

Referenced by AutoPrintTime().

Timer & Timer::AutoPrintTime ( double  auto_print)

Definition at line 169 of file timer.cpp.

References AutoPrintTime().

Timer& Timer::AutoPrintTime ( std::chrono::duration< double >  auto_print)
chrono::duration< double > Timer::ElapsedTime ( ) const

Definition at line 102 of file timer.cpp.

Referenced by operator<<().

void Timer::Iterate ( )

Definition at line 80 of file timer.cpp.

Referenced by PlotMaker::GetYield(), and main().

size_t Timer::Iteration ( ) const

Definition at line 147 of file timer.cpp.

Referenced by operator<<().

Timer & Timer::Iteration ( size_t  iteration)

Definition at line 151 of file timer.cpp.

const std::string & Timer::Label ( ) const

Definition at line 179 of file timer.cpp.

Referenced by operator<<().

Timer & Timer::Label ( const std::string &  label)

Definition at line 183 of file timer.cpp.

size_t Timer::NumIterations ( ) const

Definition at line 156 of file timer.cpp.

Referenced by operator<<().

Timer& Timer::NumIterations ( std::size_t  num_iterations)
Timer& Timer::operator= ( const Timer )
default
Timer& Timer::operator= ( Timer &&  )
default
chrono::duration< double > Timer::RemainingTime ( ) const

Definition at line 106 of file timer.cpp.

Referenced by operator<<().

void Timer::Restart ( )

Definition at line 89 of file timer.cpp.

void Timer::Restart ( std::size_t  num_iterations)

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  stream,
const Timer timer 
)
friend

Definition at line 114 of file timer.cpp.

Member Data Documentation

std::chrono::duration<double> Timer::auto_print_
private

Definition at line 62 of file timer.hpp.

bool Timer::erase_lines_
private

Definition at line 63 of file timer.hpp.

std::size_t Timer::iteration_
private

Definition at line 61 of file timer.hpp.

std::string Timer::label_
private

Definition at line 58 of file timer.hpp.

TimeType Timer::last_print_
mutableprivate

Definition at line 60 of file timer.hpp.

Referenced by operator<<().

mutex Timer::mutex_ {}
staticprivate

Definition at line 64 of file timer.hpp.

Referenced by operator<<(), and anonymous_namespace{timer.cpp}::PrintTime().

std::size_t Timer::num_iterations_
private

Definition at line 61 of file timer.hpp.

TimeType Timer::start_time_
private

Definition at line 59 of file timer.hpp.


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