ATLAS Offline Software
Loading...
Searching...
No Matches
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
}
A monitored timer.

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 }
Helper class to create a scoped timer.

◆ ~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: