Jlm
Public Member Functions | Private Attributes | List of all members
jlm::util::Timer Class Referencefinal

#include <time.hpp>

Public Member Functions

constexpr Timer ()
 
 Timer (const Timer &other)=delete
 
 Timer (Timer &&other)=default
 
Timeroperator= (const Timer &other)=delete
 
Timeroperator= (Timer &&other)=default
 
bool isRunning () const noexcept
 
void reset () noexcept
 
void start () noexcept
 
void stop () noexcept
 
size_t ns () const
 

Private Attributes

size_t ElapsedTimeInNanoseconds_
 
bool IsRunning_
 
std::chrono::time_point< std::chrono::high_resolution_clock > Start_
 

Detailed Description

Definition at line 17 of file time.hpp.

Constructor & Destructor Documentation

◆ Timer() [1/3]

constexpr jlm::util::Timer::Timer ( )
inlineconstexpr

Definition at line 20 of file time.hpp.

◆ Timer() [2/3]

jlm::util::Timer::Timer ( const Timer other)
delete

◆ Timer() [3/3]

jlm::util::Timer::Timer ( Timer &&  other)
default

Member Function Documentation

◆ isRunning()

bool jlm::util::Timer::isRunning ( ) const
inlinenoexcept

Definition at line 33 of file time.hpp.

◆ ns()

size_t jlm::util::Timer::ns ( ) const
inline

Retrieves the total time the timer has been running since the last reset. Requires the timer to not be running.

Returns
total timed runtime in wall clock nanoseconds

Definition at line 83 of file time.hpp.

◆ operator=() [1/2]

Timer& jlm::util::Timer::operator= ( const Timer other)
delete

◆ operator=() [2/2]

Timer& jlm::util::Timer::operator= ( Timer &&  other)
default

◆ reset()

void jlm::util::Timer::reset ( )
inlinenoexcept

Discards any time counted thus far. If the timer is currently running, it stops.

Definition at line 43 of file time.hpp.

◆ start()

void jlm::util::Timer::start ( )
inlinenoexcept

Starts the timer, without resetting any previously counted time. A no-op if the timer is already running.

Definition at line 54 of file time.hpp.

◆ stop()

void jlm::util::Timer::stop ( )
inlinenoexcept

Stops the timer. The timer can be resumed again by calling start(). If the timer was already stopped, this is a no-op.

Definition at line 67 of file time.hpp.

Member Data Documentation

◆ ElapsedTimeInNanoseconds_

size_t jlm::util::Timer::ElapsedTimeInNanoseconds_
private

Definition at line 91 of file time.hpp.

◆ IsRunning_

bool jlm::util::Timer::IsRunning_
private

Definition at line 92 of file time.hpp.

◆ Start_

std::chrono::time_point<std::chrono::high_resolution_clock> jlm::util::Timer::Start_
private

Definition at line 93 of file time.hpp.


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