The Gaudi Framework  v30r3 (a5ef0a68)
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 
13 
15 {
17  if ( UNLIKELY( sc.isFailure() ) ) return sc;
18 
19  m_chronoSvc = serviceLocator()->service( "ChronoStatSvc" );
20  if ( UNLIKELY( !m_chronoSvc.get() ) ) {
21  error() << "Cannot get ChronoStatSvc" << endmsg;
22  return StatusCode::FAILURE;
23  }
24  return StatusCode::SUCCESS;
25 }
26 
27 void ChronoAuditor::i_before( CustomEventTypeRef evt, const std::string& caller )
28 {
29  chronoSvc()->chronoStart( i_id( evt, caller ) );
30 }
31 
32 void ChronoAuditor::i_after( CustomEventTypeRef evt, const std::string& caller, const StatusCode& )
33 {
34  chronoSvc()->chronoStop( i_id( evt, caller ) );
35 }
#define UNLIKELY(x)
Definition: Kernel.h:122
constexpr static const auto FAILURE
Definition: StatusCode.h:88
SmartIF< IChronoStatSvc > & chronoSvc()
Definition: ChronoAuditor.h:31
bool isFailure() const
Definition: StatusCode.h:139
STL class.
#define DECLARE_COMPONENT(type)
void i_before(CustomEventTypeRef evt, const std::string &caller) override
Default (catch-all) "before" Auditor hook.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
void i_after(CustomEventTypeRef evt, const std::string &caller, const StatusCode &sc) override
Default (catch-all) "after" Auditor hook.
Monitors the cpu time usage of each algorithm.
Definition: ChronoAuditor.h:14
virtual StatusCode initialize()
Definition: Auditor.cpp:70
std::string i_id(CustomEventTypeRef evt, const std::string &caller)
Compute the id string to be used for the chrono entity.
Definition: ChronoAuditor.h:29
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
evt
Definition: IOTest.py:96