NumCpp  2.12.1
A Templatized Header Only C++ Implementation of the Python NumPy Library
nc::Timer< TimeUnit > Class Template Reference

A timer class for timing code execution. More...

#include <Timer.hpp>

Public Types

using ChronoClock = std::chrono::steady_clock
 
using TimePoint = std::chrono::time_point< ChronoClock >
 

Public Member Functions

 Timer ()
 
 Timer (const std::string &inName)
 
void setName (const std::string &inName)
 
void sleep (uint32 length)
 
void tic () noexcept
 
TimeUnit toc (PrintElapsedTime printElapsedTime=PrintElapsedTime::YES)
 

Detailed Description

template<typename TimeUnit = std::chrono::milliseconds>
class nc::Timer< TimeUnit >

A timer class for timing code execution.

Member Typedef Documentation

◆ ChronoClock

template<typename TimeUnit = std::chrono::milliseconds>
using nc::Timer< TimeUnit >::ChronoClock = std::chrono::steady_clock

◆ TimePoint

template<typename TimeUnit = std::chrono::milliseconds>
using nc::Timer< TimeUnit >::TimePoint = std::chrono::time_point<ChronoClock>

Constructor & Destructor Documentation

◆ Timer() [1/2]

template<typename TimeUnit = std::chrono::milliseconds>
nc::Timer< TimeUnit >::Timer ( )
inline

Constructor

◆ Timer() [2/2]

template<typename TimeUnit = std::chrono::milliseconds>
nc::Timer< TimeUnit >::Timer ( const std::string &  inName)
inlineexplicit

Constructor

Parameters
inName

Member Function Documentation

◆ setName()

template<typename TimeUnit = std::chrono::milliseconds>
void nc::Timer< TimeUnit >::setName ( const std::string &  inName)
inline

Sets/changes the timer name

Parameters
inName

◆ sleep()

template<typename TimeUnit = std::chrono::milliseconds>
void nc::Timer< TimeUnit >::sleep ( uint32  length)
inline

Sleeps the current thread

Parameters
lengththe length of time to sleep

◆ tic()

template<typename TimeUnit = std::chrono::milliseconds>
void nc::Timer< TimeUnit >::tic ( )
inlinenoexcept

Starts the timer

◆ toc()

template<typename TimeUnit = std::chrono::milliseconds>
TimeUnit nc::Timer< TimeUnit >::toc ( PrintElapsedTime  printElapsedTime = PrintElapsedTime::YES)
inline

Stops the timer

Parameters
printElapsedTimewhether or not to print the elapsed time to the console
Returns
ellapsed time in specified time units

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