| The Gaudi Framework v29r0 (ff2e7097)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

ChronoAuditor.cpp
Go to the documentation of this file.
1 // ChronoAuditor:
2 // An auditor that monitors time
3
4 #ifdef __ICC
5 // disable icc warning #654: overloaded virtual function "B::Y" is only partially overridden in class "C"
6 // TODO: there is only a partial overload of IAuditor::before and IAuditor::after
7 #pragma warning( disable : 654 )
8 #endif
9
10 #include "ChronoAuditor.h"
11
12 DECLARE_COMPONENT( ChronoAuditor )
13
14 ChronoAuditor::ChronoAuditor( const std::string& name, ISvcLocator* pSvcLocator ) : CommonAuditor( name, pSvcLocator )
15 {
16 }
17
18 StatusCode ChronoAuditor::initialize()
19 {
20 StatusCode sc = CommonAuditor::initialize();
21 if ( UNLIKELY( sc.isFailure() ) ) return sc;
22
23 m_chronoSvc = serviceLocator()->service( "ChronoStatSvc" );
24 if ( UNLIKELY( !m_chronoSvc.get() ) ) {
25 error() << "Cannot get ChronoStatSvc" << endmsg;
26 return StatusCode::FAILURE;
27 }
28 return StatusCode::SUCCESS;
29 }
30
31 void ChronoAuditor::i_before( CustomEventTypeRef evt, const std::string& caller )
32 {
33 chronoSvc()->chronoStart( i_id( evt, caller ) );
34 }
35
36 void ChronoAuditor::i_after( CustomEventTypeRef evt, const std::string& caller, const StatusCode& )
37 {
38 chronoSvc()->chronoStop( i_id( evt, caller ) );
39 }
UNLIKELY
#define UNLIKELY(x)
Definition: Kernel.h:128
StatusCode::SUCCESS
Definition: StatusCode.h:31
ISvcLocator
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:32
StatusCode::FAILURE
Definition: StatusCode.h:31
ChronoAuditor::chronoSvc
SmartIF< IChronoStatSvc > & chronoSvc()
Definition: ChronoAuditor.h:33
CommonAuditor
Base class with common functionalities shared by few auditor implementations.
Definition: CommonAuditor.h:8
std
STL namespace.
StatusCode::isFailure
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
ChronoAuditor.h
DECLARE_COMPONENT
#define DECLARE_COMPONENT(type)
Definition: PluginService.h:33
std::string
STL class.
SmartIF::get
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:82
ISvcLocator::service
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:79
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:111
ChronoAuditor::i_before
void i_before(CustomEventTypeRef evt, const std::string &caller) override
Default (catch-all) "before" Auditor hook.
Definition: ChronoAuditor.cpp:31
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
Auditor::serviceLocator
SmartIF< ISvcLocator > & serviceLocator() const override
The standard service locator.
Definition: Auditor.cpp:206
ChronoAuditor::m_chronoSvc
SmartIF< IChronoStatSvc > m_chronoSvc
Definition: ChronoAuditor.h:34
ChronoAuditor::i_after
void i_after(CustomEventTypeRef evt, const std::string &caller, const StatusCode &sc) override
Default (catch-all) "after" Auditor hook.
Definition: ChronoAuditor.cpp:36
ChronoAuditor
Monitors the cpu time usage of each algorithm.
Definition: ChronoAuditor.h:14
ChronoAuditor::initialize
StatusCode initialize() override
Definition: ChronoAuditor.cpp:18
Auditor::initialize
virtual StatusCode initialize()
Definition: Auditor.cpp:70
ChronoAuditor::i_id
std::string i_id(CustomEventTypeRef evt, const std::string &caller)
Compute the id string to be used for the chrono entity.
Definition: ChronoAuditor.h:31
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
IOTest.evt
evt
Definition: IOTest.py:96