DiSMEC++
dismec::stats::ScopeTimer Class Reference

#include <timer.h>

Public Member Functions

 ~ScopeTimer ()
 
 ScopeTimer (const ScopeTimer &)=delete
 
ScopeTimer operator= (const ScopeTimer &)=delete
 
 ScopeTimer (ScopeTimer &&other) noexcept
 Move constructor. Needs to disable recording for the moved-from timer. More...
 

Private Types

using clock_t = std::chrono::high_resolution_clock
 

Private Member Functions

 ScopeTimer (StatisticsCollection *accu, stat_id_t id)
 
void record_duration ()
 

Static Private Member Functions

static bool is_enabled (const StatisticsCollection *accu, stat_id_t stat)
 

Private Attributes

stat_id_t m_Target
 
bool m_Enabled = false
 
clock_t::time_point m_Start
 
StatisticsCollectionm_Accu
 

Friends

ScopeTimer record_scope_time (StatisticsCollection &accumulator, stat_id_t id)
 

Detailed Description

Definition at line 15 of file timer.h.

Member Typedef Documentation

◆ clock_t

using dismec::stats::ScopeTimer::clock_t = std::chrono::high_resolution_clock
private

Definition at line 16 of file timer.h.

Constructor & Destructor Documentation

◆ ScopeTimer() [1/3]

dismec::stats::ScopeTimer::ScopeTimer ( StatisticsCollection accu,
stat_id_t  id 
)
inlineprivate

Definition at line 24 of file timer.h.

References m_Enabled, and m_Start.

◆ ~ScopeTimer()

dismec::stats::ScopeTimer::~ScopeTimer ( )
inline

Definition at line 36 of file timer.h.

References m_Enabled, and record_duration().

◆ ScopeTimer() [2/3]

dismec::stats::ScopeTimer::ScopeTimer ( const ScopeTimer )
delete

◆ ScopeTimer() [3/3]

dismec::stats::ScopeTimer::ScopeTimer ( ScopeTimer &&  other)
inlinenoexcept

Move constructor. Needs to disable recording for the moved-from timer.

Definition at line 47 of file timer.h.

References dismec::stats::StatisticsCollection::m_Enabled.

Member Function Documentation

◆ is_enabled()

bool ScopeTimer::is_enabled ( const StatisticsCollection accu,
stat_id_t  stat 
)
staticprivate

Definition at line 16 of file timer.cpp.

References dismec::stats::StatisticsCollection::is_enabled().

◆ operator=()

ScopeTimer dismec::stats::ScopeTimer::operator= ( const ScopeTimer )
delete

◆ record_duration()

void ScopeTimer::record_duration ( )
private

Definition at line 11 of file timer.cpp.

References m_Accu, m_Start, m_Target, and dismec::stats::StatisticsCollection::record().

Referenced by ~ScopeTimer().

Friends And Related Function Documentation

◆ record_scope_time

ScopeTimer record_scope_time ( StatisticsCollection accumulator,
stat_id_t  id 
)
friend

Definition at line 53 of file timer.h.

Member Data Documentation

◆ m_Accu

StatisticsCollection* dismec::stats::ScopeTimer::m_Accu
private

Definition at line 20 of file timer.h.

Referenced by record_duration().

◆ m_Enabled

bool dismec::stats::ScopeTimer::m_Enabled = false
private

Definition at line 18 of file timer.h.

Referenced by ScopeTimer(), and ~ScopeTimer().

◆ m_Start

clock_t::time_point dismec::stats::ScopeTimer::m_Start
private

Definition at line 19 of file timer.h.

Referenced by record_duration(), and ScopeTimer().

◆ m_Target

stat_id_t dismec::stats::ScopeTimer::m_Target
private

Definition at line 17 of file timer.h.

Referenced by record_duration().


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