Inheritance diagram for TimingAuditor:
Public Types | |
SUCCESS | |
NO_INTERFACE | |
VERSMISMATCH | |
LAST_ERROR | |
enum | Status |
typedef std::string | CustomEventType |
typedef const CustomEventType & | CustomEventTypeRef |
Initialize | |
ReInitialize | |
Execute | |
BeginRun | |
EndRun | |
Finalize | |
Start | |
Stop | |
ReStart | |
SUCCESS | |
NO_INTERFACE | |
VERSMISMATCH | |
LAST_ERROR | |
enum | StandardEventType |
enum | Status |
Public Member Functions | |
virtual void | before (StandardEventType evt, INamedInterface *alg) |
virtual void | after (StandardEventType evt, INamedInterface *alg, const StatusCode &sc) |
virtual void | before (CustomEventTypeRef evt, const std::string &name) |
virtual void | after (CustomEventTypeRef evt, const std::string &name, const StatusCode &sc) |
virtual void | handle (const Incident &) |
Inform that a new incident has occured. | |
virtual StatusCode | initialize () |
virtual StatusCode | finalize () |
virtual StatusCode | queryInterface (const InterfaceID &riid, void **ppvInterface) |
TimingAuditor (const std::string &name, ISvcLocator *pSvc) | |
standard constructor | |
virtual | ~TimingAuditor () |
virtual destructor | |
virtual unsigned long | addRef ()=0 |
virtual unsigned long | release ()=0 |
StatusCode | sysInitialize () |
StatusCode | sysFinalize () |
virtual void | before (StandardEventType, INamedInterface *) |
virtual void | before (StandardEventType, const std::string &) |
virtual void | before (CustomEventTypeRef, INamedInterface *) |
virtual void | before (CustomEventTypeRef, const std::string &) |
virtual void | before (StandardEventType, INamedInterface *)=0 |
virtual void | before (StandardEventType, const std::string &)=0 |
virtual void | after (StandardEventType, INamedInterface *, const StatusCode &) |
virtual void | after (StandardEventType, const std::string &, const StatusCode &) |
virtual void | after (CustomEventTypeRef, INamedInterface *, const StatusCode &) |
virtual void | after (CustomEventTypeRef, const std::string &, const StatusCode &) |
virtual void | after (StandardEventType, INamedInterface *, const StatusCode &sc=StatusCode(StatusCode::SUCCESS, true))=0 |
virtual void | after (StandardEventType, const std::string &, const StatusCode &sc=StatusCode(StatusCode::SUCCESS, true))=0 |
virtual void | beforeInitialize (INamedInterface *) |
virtual void | afterInitialize (INamedInterface *) |
virtual void | beforeReinitialize (INamedInterface *) |
virtual void | afterReinitialize (INamedInterface *) |
virtual void | beforeExecute (INamedInterface *) |
virtual void | afterExecute (INamedInterface *, const StatusCode &) |
virtual void | beforeFinalize (INamedInterface *) |
virtual void | afterFinalize (INamedInterface *) |
virtual void | beforeBeginRun (INamedInterface *) |
virtual void | afterBeginRun (INamedInterface *) |
virtual void | beforeEndRun (INamedInterface *) |
virtual void | afterEndRun (INamedInterface *) |
virtual const std::string & | name () const |
virtual bool | isEnabled () const |
IMessageSvc * | msgSvc () const |
int | outputLevel () const |
void | setOutputLevel (int level) |
ISvcLocator * | serviceLocator () const |
StatusCode | service (const std::string &name, T *&svc, bool createIf=false) const |
virtual StatusCode | setProperty (const Property &p) |
virtual StatusCode | setProperty (const std::string &s) |
virtual StatusCode | setProperty (const std::string &n, const std::string &v) |
StatusCode | setProperty (const std::string &name, const TYPE &value) |
virtual StatusCode | getProperty (Property *p) const |
virtual const Property & | getProperty (const std::string &name) const |
virtual StatusCode | getProperty (const std::string &n, std::string &v) const |
const std::vector< Property * > & | getProperties () const |
StatusCode | setProperties () |
Property * | declareProperty (const std::string &name, T &property, const std::string &doc="none") const |
unsigned long | addRef () |
unsigned long | release () |
Static Public Member Functions | |
static const InterfaceID & | interfaceID () |
static const InterfaceID & | interfaceID () |
Public Attributes | |
SUCCESS | |
NO_INTERFACE | |
VERSMISMATCH | |
LAST_ERROR | |
Initialize | |
ReInitialize | |
Execute | |
BeginRun | |
EndRun | |
Finalize | |
Start | |
Stop | |
ReStart | |
Private Types | |
typedef GaudiUtils::VectorMap< const INamedInterface *, int > | Map |
typedef GaudiUtils::HashMap< std::string, int > | MapUser |
Private Member Functions | |
void | i_beforeInitialize (INamedInterface *alg) |
void | i_afterInitialize (INamedInterface *alg) |
void | i_beforeExecute (INamedInterface *alg) |
void | i_afterExecute (INamedInterface *alg) |
TimingAuditor () | |
TimingAuditor (const TimingAuditor &) | |
TimingAuditor & | operator= (const TimingAuditor &) |
Private Attributes | |
IToolSvc * | m_toolSvc |
tool service | |
IIncidentSvc * | m_incSvc |
incident service | |
ISequencerTimerTool * | m_timer |
the timer tool | |
INamedInterface * | m_appMgr |
ApplicationManager. | |
Map | m_map |
int | m_indent |
indentation level | |
bool | m_inEvent |
"In event" flag | |
bool | m_goodForDOD |
"optimized for DOD" | |
MapUser | m_mapUser |
map used to record user timing events |
Definition at line 29 of file TimingAuditor.cpp.
typedef GaudiUtils::VectorMap<const INamedInterface*,int> TimingAuditor::Map [private] |
Definition at line 97 of file TimingAuditor.cpp.
typedef GaudiUtils::HashMap<std::string,int> TimingAuditor::MapUser [private] |
Definition at line 106 of file TimingAuditor.cpp.
TimingAuditor::TimingAuditor | ( | const std::string & | name, | |
ISvcLocator * | pSvc | |||
) | [inline] |
standard constructor
Definition at line 59 of file TimingAuditor.cpp.
00061 : Auditor ( name , pSvc ) 00062 // 00063 , m_toolSvc ( 0 ) 00064 , m_incSvc ( 0 ) 00065 // 00066 , m_timer ( 0 ) 00067 // 00068 , m_appMgr ( 0 ) 00069 // 00070 , m_map ( ) 00071 , m_indent ( 0 ) 00072 , m_inEvent ( false ) 00073 , m_goodForDOD ( false ) 00074 , m_mapUser ( ) 00075 { 00076 declareProperty ( "OptimizedForDOD" , m_goodForDOD ) ; 00077 } ;
virtual TimingAuditor::~TimingAuditor | ( | ) | [inline, virtual] |
TimingAuditor::TimingAuditor | ( | ) | [private] |
TimingAuditor::TimingAuditor | ( | const TimingAuditor & | ) | [private] |
void TimingAuditor::before | ( | StandardEventType | evt, | |
INamedInterface * | alg | |||
) | [virtual] |
Definition at line 215 of file TimingAuditor.cpp.
00216 { 00217 switch (evt) { 00218 case IAuditor::Initialize : i_beforeInitialize( alg ); break; 00219 case IAuditor::Execute : i_beforeExecute( alg ); break; 00220 default: break; 00221 } 00222 }
void TimingAuditor::after | ( | StandardEventType | evt, | |
INamedInterface * | alg, | |||
const StatusCode & | sc | |||
) | [virtual] |
Definition at line 224 of file TimingAuditor.cpp.
00225 { 00226 switch (evt) { 00227 case IAuditor::Initialize : i_afterInitialize( alg ); break; 00228 case IAuditor::Execute : i_afterExecute( alg ); break; 00229 default: break; 00230 } 00231 }
void TimingAuditor::before | ( | CustomEventTypeRef | evt, | |
const std::string & | name | |||
) | [virtual] |
Definition at line 298 of file TimingAuditor.cpp.
00299 { 00300 // Ignore obvious mistakes 00301 if ( name.empty() && evt.empty() ) { return; } 00302 00303 // look for the user timer in the map 00304 int timer = 0; 00305 std::string nick = name + ":" + evt; 00306 MapUser::iterator found = m_mapUser.find( nick ); 00307 00308 if ( m_mapUser.end() == found ) { 00309 // add a new timer if not yet available 00310 timer = m_timer->addTimer( nick ) ; 00311 m_mapUser[nick] = timer; 00312 } 00313 else { 00314 timer = found->second; 00315 } 00316 00317 m_timer->start( timer ); 00318 }
void TimingAuditor::after | ( | CustomEventTypeRef | evt, | |
const std::string & | name, | |||
const StatusCode & | sc | |||
) | [virtual] |
Definition at line 320 of file TimingAuditor.cpp.
00321 { 00322 // Ignore obvious mistakes 00323 if ( name.empty() && evt.empty() ) { return; } 00324 00325 // look for the user timer in the map 00326 std::string nick = name + ":" + evt; 00327 MapUser::iterator found = m_mapUser.find( nick ); 00328 00329 // We cannot do much if the timer is not available 00330 if ( m_mapUser.end() == found ) { 00331 MsgStream log(msgSvc(), this->name()); 00332 log << MSG::WARNING << "Trying to stop the measure of the timing for '" 00333 << nick << "' but it was never started. Check the code" 00334 << endmsg; 00335 return; 00336 } 00337 m_timer->stop( found->second ); 00338 }
void TimingAuditor::i_beforeInitialize | ( | INamedInterface * | alg | ) | [private] |
Definition at line 233 of file TimingAuditor.cpp.
00234 { 00235 if ( m_goodForDOD ) { return ; } 00236 // 00237 if ( 0 == alg ) { return ; } 00238 Map::iterator found = m_map.find( alg ) ; 00239 if ( m_map.end() != found ) { return ; } 00240 ++m_indent ; 00241 std::string nick = alg->name() ; 00242 if ( 0 < m_indent ) { nick = std::string ( m_indent , ' ') + nick ; } 00243 if ( m_inEvent ) 00244 { 00245 nick[0] = '*' ; 00246 MsgStream log( msgSvc() , name() ) ; 00247 log << MSG::DEBUG 00248 << "Insert non-structural component '" 00249 << alg->name() << "' of type '" 00250 << System::typeinfoName(typeid(*alg)) << "' at level " 00251 << m_indent << endreq ; 00252 } 00253 int timer = m_timer->addTimer( nick ) ; 00254 m_map.insert ( alg , timer ) ; 00255 m_timer->start( timer ) ; 00256 }
void TimingAuditor::i_afterInitialize | ( | INamedInterface * | alg | ) | [private] |
Definition at line 258 of file TimingAuditor.cpp.
00259 { 00260 if ( m_goodForDOD ) { return ; } 00261 if ( 0 == alg ) { return ; } 00262 --m_indent ; 00263 }
void TimingAuditor::i_beforeExecute | ( | INamedInterface * | alg | ) | [private] |
Definition at line 265 of file TimingAuditor.cpp.
00266 { 00267 if ( 0 == alg ) { return ; } 00268 ++m_indent ; 00269 Map::iterator found = m_map.find( alg ) ; 00270 if ( m_map.end() == found ) 00271 { 00272 MsgStream log( msgSvc() , name() ) ; 00273 log << MSG::DEBUG 00274 << "Insert non-structural component '" 00275 << alg->name() << "' of type '" 00276 << System::typeinfoName(typeid(*alg)) << "' at level " 00277 << m_indent << endreq ; 00278 std::string nick = alg->name() ; 00279 if ( 0 < m_indent ) { nick = std::string ( m_indent , ' ') + nick ; } 00280 if ( !m_goodForDOD ) { nick[0]='*' ;} 00281 int timer = m_timer->addTimer( nick ) ; 00282 m_map.insert ( alg , timer ) ; 00283 m_timer->start( timer ) ; 00284 return ; 00285 } 00286 m_timer->start( found->second ) ; 00287 }
void TimingAuditor::i_afterExecute | ( | INamedInterface * | alg | ) | [private] |
Definition at line 289 of file TimingAuditor.cpp.
00290 { 00291 if ( 0 == alg ) { return ; } 00292 Map::iterator found = m_map.find( alg ) ; 00293 if ( m_map.end() == found ) { return ; } 00294 m_timer->stop( found->second ) ; 00295 --m_indent ; 00296 }
void TimingAuditor::handle | ( | const Incident & | ) | [virtual] |
Inform that a new incident has occured.
Implements IIncidentListener.
Definition at line 340 of file TimingAuditor.cpp.
00341 { 00342 if ( IncidentType::BeginEvent == i.type () ) 00343 { 00344 m_timer -> start ( m_map[ m_appMgr ] ) ; 00345 ++m_indent ; 00346 m_inEvent = true ; 00347 } 00348 else if ( IncidentType::EndEvent == i.type () ) 00349 { 00350 m_timer -> stop ( m_map[ m_appMgr ] ) ; 00351 --m_indent ; 00352 m_inEvent = false ; 00353 } 00354 }
StatusCode TimingAuditor::initialize | ( | ) | [virtual] |
Reimplemented from Auditor.
Definition at line 128 of file TimingAuditor.cpp.
00129 { 00130 StatusCode sc = Auditor::initialize() ; 00131 if ( sc.isFailure() ) { return sc ; } // RETURN 00132 00133 MsgStream log ( msgSvc() , name() ) ; 00134 00135 // get tool service 00136 if ( 0 == m_toolSvc ) 00137 { 00138 StatusCode sc = Auditor::service ( "ToolSvc" , m_toolSvc ) ; 00139 if ( sc.isFailure() ) 00140 { 00141 log << "Could not retrieve 'ToolSvc' " << sc << endreq ; 00142 return sc ; // RETURN 00143 } 00144 if ( 0 == m_timer ) 00145 { 00146 sc = m_toolSvc->retrieveTool 00147 ( "SequencerTimerTool/TIMER" , m_timer , this , true ) ; 00148 if ( sc.isFailure() ) 00149 { 00150 log << MSG::ERROR 00151 << "Could not retrieve ISequencerTimerTool" << endreq ; 00152 return sc ; 00153 } 00154 } 00155 } 00156 // get incident service 00157 if ( 0 == m_incSvc ) 00158 { 00159 StatusCode sc = Auditor::service ( "IncidentSvc" , m_incSvc ) ; 00160 if ( sc.isFailure() ) 00161 { 00162 log << MSG::ERROR 00163 << "Could not retrieve 'IncidentSvc'" << sc << endreq ; 00164 return sc ; 00165 } 00166 m_incSvc -> addListener ( this , IncidentType::BeginEvent ) ; 00167 m_incSvc -> addListener ( this , IncidentType::EndEvent ) ; 00168 } 00169 // get the application manager 00170 if ( 0 == m_appMgr ) 00171 { 00172 StatusCode sc = Auditor::service ( "ApplicationMgr" , m_appMgr ) ; 00173 if ( sc.isFailure() ) 00174 { 00175 log << MSG::ERROR 00176 << "Could not retrieve 'ApplicationMgr'" << sc << endreq ; 00177 return sc ; 00178 } 00179 if ( m_map.end() == m_map.find( m_appMgr ) ) 00180 { 00181 int timer = m_timer->addTimer( "EVENT LOOP" ) ; 00182 m_map.insert ( m_appMgr , timer ) ; 00183 } 00184 } 00185 // 00186 return StatusCode::SUCCESS ; 00187 }
StatusCode TimingAuditor::finalize | ( | ) | [virtual] |
Reimplemented from Auditor.
Definition at line 189 of file TimingAuditor.cpp.
00190 { 00191 if ( 0 != m_incSvc ) 00192 { 00193 m_incSvc -> removeListener ( this , IncidentType::BeginEvent ) ; 00194 m_incSvc -> removeListener ( this , IncidentType::EndEvent ) ; 00195 m_incSvc -> release () ; 00196 m_incSvc = 0 ; 00197 } 00198 if ( 0 != m_toolSvc ) 00199 { 00200 // the 2 following line are commented out: it is 00201 // is a temporary hack which prevent a crash due to a problem in 00202 // the reference counting 00203 // if ( 0 != m_timer ) 00204 // { m_toolSvc -> releaseTool ( m_timer ) . ignore() ; m_timer = 0 ; } 00205 m_toolSvc -> release () ; 00206 m_toolSvc = 0 ; 00207 } 00208 if ( 0 != m_appMgr ) { m_appMgr -> release () ; m_appMgr = 0 ; } 00209 // clear the map 00210 m_map.clear() ; 00211 // finalize the base class 00212 return Auditor::finalize () ; 00213 }
StatusCode TimingAuditor::queryInterface | ( | const InterfaceID & | riid, | |
void ** | ppvInterface | |||
) | [virtual] |
Reimplemented from Auditor.
Definition at line 116 of file TimingAuditor.cpp.
00118 { 00119 if ( 0 == ppv ) { return StatusCode::FAILURE ; } // RETURN 00120 else if ( IIncidentListener::interfaceID() == riid ) 00121 { *ppv = static_cast<IIncidentListener*> ( this ) ; } 00122 else 00123 { return Auditor::queryInterface( riid , ppv ) ; } // RETURN 00124 addRef() ; 00125 return StatusCode::SUCCESS ; 00126 } ;
TimingAuditor& TimingAuditor::operator= | ( | const TimingAuditor & | ) | [private] |
IToolSvc* TimingAuditor::m_toolSvc [private] |
IIncidentSvc* TimingAuditor::m_incSvc [private] |
ISequencerTimerTool* TimingAuditor::m_timer [private] |
INamedInterface* TimingAuditor::m_appMgr [private] |
Map TimingAuditor::m_map [private] |
Definition at line 98 of file TimingAuditor.cpp.
int TimingAuditor::m_indent [private] |
bool TimingAuditor::m_inEvent [private] |
bool TimingAuditor::m_goodForDOD [private] |
MapUser TimingAuditor::m_mapUser [private] |