ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
Athena::Chrono Class Reference

Exception-safe IChronoSvc caller. More...

#include <Chrono.h>

Collaboration diagram for Athena::Chrono:

Public Member Functions

 Chrono (const std::string &name, IChronoSvc *svc)
 Start a IChronoSvc timer. More...
 
 ~Chrono ()
 Destructor. More...
 

Private Attributes

std::string m_name
 
IChronoSvc * m_svc
 

Detailed Description

Exception-safe IChronoSvc caller.

The way to time something using the Gaudi IChronoSvc is like this:

chronosvc->chronoStart ("someName");
doSomething();
chronosvc->chronoStop ("someName");

This is of course not exception-safe.

This wrapper provides an exception-safe way of calling IChronoSvc:

{
Chrono chrono ("someName", chronosvc);
doSomething();
}

Definition at line 49 of file Chrono.h.

Constructor & Destructor Documentation

◆ Chrono()

Athena::Chrono::Chrono ( const std::string &  name,
IChronoSvc *  svc 
)
inline

Start a IChronoSvc timer.

Parameters
nameName of the timer.
svcThe IChronoSvc.

The timer will stop when this object is destroyed.

Definition at line 59 of file Chrono.h.

60  : m_name (name),
61  m_svc (svc)
62  {
63  m_svc->chronoStart (m_name);
64  }

◆ ~Chrono()

Athena::Chrono::~Chrono ( )
inline

Destructor.

Stop the timer.

Definition at line 70 of file Chrono.h.

71  {
72  m_svc->chronoStop (m_name);
73  }

Member Data Documentation

◆ m_name

std::string Athena::Chrono::m_name
private

Definition at line 77 of file Chrono.h.

◆ m_svc

IChronoSvc* Athena::Chrono::m_svc
private

Definition at line 78 of file Chrono.h.


The documentation for this class was generated from the following file:
Athena::Chrono::m_name
std::string m_name
Definition: Chrono.h:77
Athena::Chrono::Chrono
Chrono(const std::string &name, IChronoSvc *svc)
Start a IChronoSvc timer.
Definition: Chrono.h:59
Handler::svc
AthROOTErrorHandlerSvc * svc
Definition: AthROOTErrorHandlerSvc.cxx:10
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
Athena::Chrono::m_svc
IChronoSvc * m_svc
Definition: Chrono.h:78