OmniSciDB  72c90bc290
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CpuTimer::EventTimer Struct Reference
+ Collaboration diagram for CpuTimer::EventTimer:

Public Member Functions

 EventTimer (const std::string &event_label, const size_t nest_level, const bool make_nested)
 
time_point finalize ()
 

Public Attributes

std::string event_label
 
time_point start_time
 
time_point end_time
 
std::shared_ptr< CpuTimernested_event_timer {nullptr}
 
bool is_finished {false}
 

Detailed Description

Definition at line 66 of file CpuTimer.hpp.

Constructor & Destructor Documentation

CpuTimer::EventTimer::EventTimer ( const std::string &  event_label,
const size_t  nest_level,
const bool  make_nested 
)
inline

Definition at line 73 of file CpuTimer.hpp.

References nested_event_timer.

77  , start_time(std::chrono::high_resolution_clock::now()) {
78  if (make_nested) {
79  const std::string nested_event_label{event_label + " sub-steps"};
81  std::make_shared<CpuTimer>(nested_event_label, nest_level + 1);
82  }
83  }
std::shared_ptr< CpuTimer > nested_event_timer
Definition: CpuTimer.hpp:70
std::string event_label
Definition: CpuTimer.hpp:67
time_point start_time
Definition: CpuTimer.hpp:68

Member Function Documentation

time_point CpuTimer::EventTimer::finalize ( )
inline

Definition at line 85 of file CpuTimer.hpp.

References end_time, is_finished, and nested_event_timer.

85  {
86  if (!is_finished) {
87  if (nested_event_timer != nullptr) {
88  nested_event_timer->finalize();
89  }
90  end_time = std::chrono::high_resolution_clock::now();
91  is_finished = true;
92  }
93  return end_time;
94  }
std::shared_ptr< CpuTimer > nested_event_timer
Definition: CpuTimer.hpp:70
time_point end_time
Definition: CpuTimer.hpp:69

Member Data Documentation

time_point CpuTimer::EventTimer::end_time

Definition at line 69 of file CpuTimer.hpp.

Referenced by finalize().

std::string CpuTimer::EventTimer::event_label

Definition at line 67 of file CpuTimer.hpp.

bool CpuTimer::EventTimer::is_finished {false}

Definition at line 71 of file CpuTimer.hpp.

Referenced by finalize().

std::shared_ptr<CpuTimer> CpuTimer::EventTimer::nested_event_timer {nullptr}

Definition at line 70 of file CpuTimer.hpp.

Referenced by EventTimer(), and finalize().

time_point CpuTimer::EventTimer::start_time

Definition at line 68 of file CpuTimer.hpp.


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