ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
Monitored::ScopedTimer< T > Class Template Reference

Helper class to create a scoped timer. More...

#include <MonitoredTimer.h>

Collaboration diagram for Monitored::ScopedTimer< T >:

Public Member Functions

 ScopedTimer (T &timer)
 
 ~ScopedTimer ()
 

Private Attributes

T & m_timer
 

Detailed Description

template<typename T>
class Monitored::ScopedTimer< T >

Helper class to create a scoped timer.

This helper will call start()/stop() of the specified Monitored::Timer on creation/destruction. It is useful in case there is unrelated code between creation of the Monitored::Timer and the code of interest.

auto t1 = Monitored::Timer("TIME_t1");
// unrelated code
{
ScopedTimer timeit(t1);
// code to be timed
}

Definition at line 95 of file MonitoredTimer.h.

Constructor & Destructor Documentation

◆ ScopedTimer()

template<typename T >
Monitored::ScopedTimer< T >::ScopedTimer ( T &  timer)
inline

Definition at line 97 of file MonitoredTimer.h.

97  : m_timer(timer) {
98  m_timer.start();
99  }

◆ ~ScopedTimer()

template<typename T >
Monitored::ScopedTimer< T >::~ScopedTimer ( )
inline

Definition at line 100 of file MonitoredTimer.h.

100  {
101  m_timer.stop();
102  }

Member Data Documentation

◆ m_timer

template<typename T >
T& Monitored::ScopedTimer< T >::m_timer
private

Definition at line 104 of file MonitoredTimer.h.


The documentation for this class was generated from the following file:
ALFA_EventTPCnv_Dict::t1
std::vector< ALFA_RawDataCollection_p1 > t1
Definition: ALFA_EventTPCnvDict.h:43
Monitored::ScopedTimer::m_timer
T & m_timer
Definition: MonitoredTimer.h:104
python.utils.AtlRunQueryTimer.timer
def timer(name, disabled=False)
Definition: AtlRunQueryTimer.py:86
Monitored::ScopedTimer::ScopedTimer
ScopedTimer(T &timer)
Definition: MonitoredTimer.h:97
Monitored::Timer
A monitored timer.
Definition: MonitoredTimer.h:32