| The Gaudi Framework v32r1 (f65d50dc)

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 StatusCode ChronoAuditor::initialize() {
15 StatusCode sc = CommonAuditor::initialize();
16 if ( UNLIKELY( sc.isFailure() ) ) return sc;
17
18 m_chronoSvc = serviceLocator()->service( "ChronoStatSvc" );
19 if ( UNLIKELY( !m_chronoSvc.get() ) ) {
20 error() << "Cannot get ChronoStatSvc" << endmsg;
21 return StatusCode::FAILURE;
22 }
23 return StatusCode::SUCCESS;
24 }
25
26 void ChronoAuditor::i_before( CustomEventTypeRef evt, const std::string& caller ) {
27 chronoSvc()->chronoStart( i_id( evt, caller ) );
28 }
29
30 void ChronoAuditor::i_after( CustomEventTypeRef evt, const std::string& caller, const StatusCode& ) {
31 chronoSvc()->chronoStop( i_id( evt, caller ) );
32 }
UNLIKELY
#define UNLIKELY(x)
Definition: Kernel.h:96
ChronoAuditor::chronoSvc
SmartIF< IChronoStatSvc > & chronoSvc()
Definition: ChronoAuditor.h:30
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
ChronoAuditor.h
std::string
STL class.
DECLARE_COMPONENT
#define DECLARE_COMPONENT(type)
Definition: PluginServiceV1.h:46
ChronoAuditor::i_before
void i_before(CustomEventTypeRef evt, const std::string &caller) override
Default (catch-all) "before" Auditor hook.
Definition: ChronoAuditor.cpp:26
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
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:30
ChronoAuditor
Monitors the cpu time usage of each algorithm.
Definition: ChronoAuditor.h:14
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:86
Auditor::initialize
virtual StatusCode initialize()
Definition: Auditor.cpp:64
StatusCode::isFailure
bool isFailure() const
Definition: StatusCode.h:130
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:28
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192
IOTest.evt
evt
Definition: IOTest.py:94