ATLAS Offline Software
Loading...
Searching...
No Matches
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.
 ~Chrono ()
 Destructor.

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();
}
Chrono(const std::string &name, IChronoSvc *svc)
Start a IChronoSvc timer.
Definition Chrono.h:59

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 }
IChronoSvc * m_svc
Definition Chrono.h:78
std::string m_name
Definition Chrono.h:77

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