1 #include "GaudiKernel/Auditor.h"
2 #include "GaudiKernel/IToolSvc.h"
3 #include "GaudiKernel/IIncidentListener.h"
4 #include "GaudiKernel/IIncidentSvc.h"
5 #include "GaudiKernel/IToolSvc.h"
6 #include "GaudiKernel/VectorMap.h"
7 #include "GaudiKernel/HashMap.h"
8 #include "GaudiKernel/MsgStream.h"
12 #include "GaudiAlg/ISequencerTimerTool.h"
17 #pragma warning(disable:654)
35 void before(CustomEventTypeRef evt,
const std::string&
name)
override;
37 void after(CustomEventTypeRef evt,
const std::string& name,
const StatusCode &sc)
override;
111 log <<
"Could not retrieve 'ToolSvc' " <<
endmsg ;
116 sc = m_toolSvc->retrieveTool
117 (
"SequencerTimerTool/TIMER" , m_timer ,
this ,
true ) ;
121 <<
"Could not retrieve ISequencerTimerTool" <<
endmsg ;
133 <<
"Could not retrieve 'IncidentSvc'" <<
endmsg ;
136 m_incSvc -> addListener (
this , IncidentType::BeginEvent ) ;
137 m_incSvc -> addListener (
this , IncidentType::EndEvent ) ;
146 <<
"Could not retrieve 'ApplicationMgr'" <<
endmsg ;
149 if ( m_map.end() == m_map.find( m_appMgr.get() ) )
151 m_map.insert ( m_appMgr.get() , m_timer->addTimer(
"EVENT LOOP" ) ) ;
162 m_incSvc -> removeListener (
this , IncidentType::BeginEvent ) ;
163 m_incSvc -> removeListener (
this , IncidentType::EndEvent ) ;
215 if ( !alg ) { return ; }
217 if (
m_map.
end() != found ) { return ; }
219 std::string nick = alg->
name() ;
226 <<
"Insert non-structural component '"
227 << alg->
name() <<
"' of type '"
244 if ( !alg ) { return ; }
251 <<
"Insert non-structural component '"
252 << alg->
name() <<
"' of type '"
255 std::string nick = alg->
name() ;
268 if ( !alg ) { return ; }
270 if (
m_map.
end() == found ) { return ; }
278 if ( name.empty() && evt.empty() ) {
return; }
282 std::string nick = name +
":" +
evt;
290 timer = found->second;
298 if ( name.empty() && evt.empty() ) {
return; }
301 std::string nick = name +
":" +
evt;
307 log <<
MSG::WARNING <<
"Trying to stop the measure of the timing for '"
308 << nick <<
"' but it was never started. Check the code"
317 if ( IncidentType::BeginEvent == i.
type () ) {
321 }
else if ( IncidentType::EndEvent == i.
type () ) {
void i_afterInitialize(INamedInterface *alg)
void i_beforeInitialize(INamedInterface *alg)
Definition of the MsgStream class used to transmit messages.
TimingAuditor & operator=(const TimingAuditor &)=delete
virtual StatusCode finalize()
StatusCode service(const std::string &name, T *&svc, bool createIf=false) const
Access a service by name, creating it if it doesn't already exist.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
const std::string & type() const
Access to the incident type.
TimingAuditor(const std::string &name, ISvcLocator *pSvc)
standard constructor
bool m_inEvent
"In event" flag
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
StatusCode finalize() override
void i_beforeExecute(INamedInterface *alg)
result_type insert(const key_type &key, const mapped_type &mapped)
insert the (key,value) pair into the container
void after(StandardEventType evt, INamedInterface *alg, const StatusCode &sc) override
bool isFailure() const
Test for a status code of FAILURE.
virtual const std::string & name() const =0
Retrieve the name of the instance.
GaudiUtils::HashMap< std::string, int > m_mapUser
map used to record user timing events
StatusCode initialize() override
factory:
iterator find(const key_type &key) const
find the element by key
TYPE * get() const
Get interface pointer.
int m_indent
indentation level
iterator end() const
"end" iterator for sequential access (const-only version!)
SmartIF< INamedInterface > m_appMgr
ApplicationManager.
This class is used for returning status codes from appropriate routines.
SmartIF< IIncidentSvc > m_incSvc
incident service
#define DECLARE_COMPONENT(type)
void before(StandardEventType evt, INamedInterface *alg) override
iterator find(const key_type &key)
void after(StandardEventType, INamedInterface *, const StatusCode &) override
~TimingAuditor() override=default
destructor
GaudiUtils::VectorMap< const INamedInterface *, int > m_map
void i_beforeFinalize(INamedInterface *alg)
IInterface compliant class extending IInterface with the name() method.
Base class used to extend a class implementing other interfaces.
Base class for all Incidents (computing events).
void clear()
clear the container
SmartIF< IToolSvc > m_toolSvc
tool service
void reset(TYPE *ptr=nullptr)
Set the internal pointer to the passed one disposing of the old one.
ISequencerTimerTool * m_timer
the timer tool
virtual StatusCode initialize()
bool m_goodForDOD
"optimized for DOD"
void handle(const Incident &) override
Inform that a new incident has occurred.
void before(StandardEventType, INamedInterface *) override
The following methods are meant to be implemented by the child class...
void i_afterExecute(INamedInterface *alg)
Simple auditor which uses SequencerTimerTool for ALL algorithms, including the algorithm from main Ga...