Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v31r0 (aeb156f0)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 
14 StatusCode ChronoAuditor::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 }
#define UNLIKELY(x)
Definition: Kernel.h:89
SmartIF< IChronoStatSvc > & chronoSvc()
Definition: ChronoAuditor.h:30
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
bool isFailure() const
Definition: StatusCode.h:130
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:50
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
constexpr static const auto FAILURE
Definition: StatusCode.h:86
virtual StatusCode initialize()
Definition: Auditor.cpp:64
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
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192
evt
Definition: IOTest.py:94