|
Gaudi Framework, version v21r8 |
| Home | Generated: 17 Mar 2010 |


Public Member Functions | |
| virtual void | before (StandardEventType evt, INamedInterface *alg) |
| The following methods are meant to be implemented by the child class... | |
| 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 occurred. | |
| virtual StatusCode | initialize () |
| factory: | |
| virtual StatusCode | finalize () |
| TimingAuditor (const std::string &name, ISvcLocator *pSvc) | |
| standard constructor | |
| virtual | ~TimingAuditor () |
| virtual destructor | |
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 28 of file TimingAuditor.cpp.
typedef GaudiUtils::VectorMap<const INamedInterface*,int> TimingAuditor::Map [private] |
Definition at line 92 of file TimingAuditor.cpp.
typedef GaudiUtils::HashMap<std::string,int> TimingAuditor::MapUser [private] |
Definition at line 101 of file TimingAuditor.cpp.
| TimingAuditor::TimingAuditor | ( | const std::string & | name, | |
| ISvcLocator * | pSvc | |||
| ) | [inline] |
standard constructor
Definition at line 54 of file TimingAuditor.cpp.
00056 : base_class ( name , pSvc ) 00057 // 00058 , m_toolSvc ( 0 ) 00059 , m_incSvc ( 0 ) 00060 // 00061 , m_timer ( 0 ) 00062 // 00063 , m_appMgr ( 0 ) 00064 // 00065 , m_map ( ) 00066 , m_indent ( 0 ) 00067 , m_inEvent ( false ) 00068 , m_goodForDOD ( false ) 00069 , m_mapUser ( ) 00070 { 00071 declareProperty ( "OptimizedForDOD" , m_goodForDOD ) ; 00072 } ;
| virtual TimingAuditor::~TimingAuditor | ( | ) | [inline, virtual] |
| TimingAuditor::TimingAuditor | ( | ) | [private] |
| TimingAuditor::TimingAuditor | ( | const TimingAuditor & | ) | [private] |
| void TimingAuditor::before | ( | StandardEventType | evt, | |
| INamedInterface * | obj | |||
| ) | [virtual] |
The following methods are meant to be implemented by the child class...
Reimplemented from Auditor.
Definition at line 197 of file TimingAuditor.cpp.
00198 { 00199 switch (evt) { 00200 case IAuditor::Initialize : i_beforeInitialize( alg ); break; 00201 case IAuditor::Execute : i_beforeExecute( alg ); break; 00202 default: break; 00203 } 00204 }
| void TimingAuditor::after | ( | StandardEventType | evt, | |
| INamedInterface * | alg, | |||
| const StatusCode & | sc | |||
| ) | [virtual] |
Reimplemented from Auditor.
Definition at line 206 of file TimingAuditor.cpp.
00207 { 00208 switch (evt) { 00209 case IAuditor::Initialize : i_afterInitialize( alg ); break; 00210 case IAuditor::Execute : i_afterExecute( alg ); break; 00211 default: break; 00212 } 00213 }
| void TimingAuditor::before | ( | CustomEventTypeRef | evt, | |
| const std::string & | name | |||
| ) | [virtual] |
Reimplemented from Auditor.
Definition at line 280 of file TimingAuditor.cpp.
00281 { 00282 // Ignore obvious mistakes 00283 if ( name.empty() && evt.empty() ) { return; } 00284 00285 // look for the user timer in the map 00286 int timer = 0; 00287 std::string nick = name + ":" + evt; 00288 MapUser::iterator found = m_mapUser.find( nick ); 00289 00290 if ( m_mapUser.end() == found ) { 00291 // add a new timer if not yet available 00292 timer = m_timer->addTimer( nick ) ; 00293 m_mapUser[nick] = timer; 00294 } 00295 else { 00296 timer = found->second; 00297 } 00298 00299 m_timer->start( timer ); 00300 }
| void TimingAuditor::after | ( | CustomEventTypeRef | evt, | |
| const std::string & | name, | |||
| const StatusCode & | sc | |||
| ) | [virtual] |
Reimplemented from Auditor.
Definition at line 302 of file TimingAuditor.cpp.
00303 { 00304 // Ignore obvious mistakes 00305 if ( name.empty() && evt.empty() ) { return; } 00306 00307 // look for the user timer in the map 00308 std::string nick = name + ":" + evt; 00309 MapUser::iterator found = m_mapUser.find( nick ); 00310 00311 // We cannot do much if the timer is not available 00312 if ( m_mapUser.end() == found ) { 00313 MsgStream log(msgSvc(), this->name()); 00314 log << MSG::WARNING << "Trying to stop the measure of the timing for '" 00315 << nick << "' but it was never started. Check the code" 00316 << endmsg; 00317 return; 00318 } 00319 m_timer->stop( found->second ); 00320 }
| void TimingAuditor::i_beforeInitialize | ( | INamedInterface * | alg | ) | [private] |
Definition at line 215 of file TimingAuditor.cpp.
00216 { 00217 if ( m_goodForDOD ) { return ; } 00218 // 00219 if ( 0 == alg ) { return ; } 00220 Map::iterator found = m_map.find( alg ) ; 00221 if ( m_map.end() != found ) { return ; } 00222 ++m_indent ; 00223 std::string nick = alg->name() ; 00224 if ( 0 < m_indent ) { nick = std::string ( m_indent , ' ') + nick ; } 00225 if ( m_inEvent ) 00226 { 00227 nick[0] = '*' ; 00228 MsgStream log( msgSvc() , name() ) ; 00229 log << MSG::DEBUG 00230 << "Insert non-structural component '" 00231 << alg->name() << "' of type '" 00232 << System::typeinfoName(typeid(*alg)) << "' at level " 00233 << m_indent << endmsg ; 00234 } 00235 int timer = m_timer->addTimer( nick ) ; 00236 m_map.insert ( alg , timer ) ; 00237 m_timer->start( timer ) ; 00238 }
| void TimingAuditor::i_afterInitialize | ( | INamedInterface * | alg | ) | [private] |
Definition at line 240 of file TimingAuditor.cpp.
00241 { 00242 if ( m_goodForDOD ) { return ; } 00243 if ( 0 == alg ) { return ; } 00244 --m_indent ; 00245 }
| void TimingAuditor::i_beforeExecute | ( | INamedInterface * | alg | ) | [private] |
Definition at line 247 of file TimingAuditor.cpp.
00248 { 00249 if ( 0 == alg ) { return ; } 00250 ++m_indent ; 00251 Map::iterator found = m_map.find( alg ) ; 00252 if ( m_map.end() == found ) 00253 { 00254 MsgStream log( msgSvc() , name() ) ; 00255 log << MSG::DEBUG 00256 << "Insert non-structural component '" 00257 << alg->name() << "' of type '" 00258 << System::typeinfoName(typeid(*alg)) << "' at level " 00259 << m_indent << endmsg ; 00260 std::string nick = alg->name() ; 00261 if ( 0 < m_indent ) { nick = std::string ( m_indent , ' ') + nick ; } 00262 if ( !m_goodForDOD ) { nick[0]='*' ;} 00263 int timer = m_timer->addTimer( nick ) ; 00264 m_map.insert ( alg , timer ) ; 00265 m_timer->start( timer ) ; 00266 return ; 00267 } 00268 m_timer->start( found->second ) ; 00269 }
| void TimingAuditor::i_afterExecute | ( | INamedInterface * | alg | ) | [private] |
| void TimingAuditor::handle | ( | const Incident & | i | ) | [virtual] |
Inform that a new incident has occurred.
Implements IIncidentListener.
Definition at line 322 of file TimingAuditor.cpp.
00323 { 00324 if ( IncidentType::BeginEvent == i.type () ) 00325 { 00326 m_timer -> start ( m_map[ m_appMgr ] ) ; 00327 ++m_indent ; 00328 m_inEvent = true ; 00329 } 00330 else if ( IncidentType::EndEvent == i.type () ) 00331 { 00332 m_timer -> stop ( m_map[ m_appMgr ] ) ; 00333 --m_indent ; 00334 m_inEvent = false ; 00335 } 00336 }
| StatusCode TimingAuditor::initialize | ( | ) | [virtual] |
factory:
Reimplemented from Auditor.
Definition at line 110 of file TimingAuditor.cpp.
00111 { 00112 StatusCode sc = Auditor::initialize() ; 00113 if ( sc.isFailure() ) { return sc ; } // RETURN 00114 00115 MsgStream log ( msgSvc() , name() ) ; 00116 00117 // get tool service 00118 if ( 0 == m_toolSvc ) 00119 { 00120 sc = Auditor::service ( "ToolSvc" , m_toolSvc ) ; 00121 if ( sc.isFailure() ) 00122 { 00123 log << "Could not retrieve 'ToolSvc' " << sc << endmsg ; 00124 return sc ; // RETURN 00125 } 00126 if ( 0 == m_timer ) 00127 { 00128 sc = m_toolSvc->retrieveTool 00129 ( "SequencerTimerTool/TIMER" , m_timer , this , true ) ; 00130 if ( sc.isFailure() ) 00131 { 00132 log << MSG::ERROR 00133 << "Could not retrieve ISequencerTimerTool" << endmsg ; 00134 return sc ; 00135 } 00136 } 00137 } 00138 // get incident service 00139 if ( 0 == m_incSvc ) 00140 { 00141 sc = Auditor::service ( "IncidentSvc" , m_incSvc ) ; 00142 if ( sc.isFailure() ) 00143 { 00144 log << MSG::ERROR 00145 << "Could not retrieve 'IncidentSvc'" << sc << endmsg ; 00146 return sc ; 00147 } 00148 m_incSvc -> addListener ( this , IncidentType::BeginEvent ) ; 00149 m_incSvc -> addListener ( this , IncidentType::EndEvent ) ; 00150 } 00151 // get the application manager 00152 if ( 0 == m_appMgr ) 00153 { 00154 sc = Auditor::service ( "ApplicationMgr" , m_appMgr ) ; 00155 if ( sc.isFailure() ) 00156 { 00157 log << MSG::ERROR 00158 << "Could not retrieve 'ApplicationMgr'" << sc << endmsg ; 00159 return sc ; 00160 } 00161 if ( m_map.end() == m_map.find( m_appMgr ) ) 00162 { 00163 int timer = m_timer->addTimer( "EVENT LOOP" ) ; 00164 m_map.insert ( m_appMgr , timer ) ; 00165 } 00166 } 00167 // 00168 return StatusCode::SUCCESS ; 00169 }
| StatusCode TimingAuditor::finalize | ( | void | ) | [virtual] |
Reimplemented from Auditor.
Definition at line 171 of file TimingAuditor.cpp.
00172 { 00173 if ( 0 != m_incSvc ) 00174 { 00175 m_incSvc -> removeListener ( this , IncidentType::BeginEvent ) ; 00176 m_incSvc -> removeListener ( this , IncidentType::EndEvent ) ; 00177 m_incSvc -> release () ; 00178 m_incSvc = 0 ; 00179 } 00180 if ( 0 != m_toolSvc ) 00181 { 00182 // the 2 following line are commented out: it is 00183 // is a temporary hack which prevent a crash due to a problem in 00184 // the reference counting 00185 // if ( 0 != m_timer ) 00186 // { m_toolSvc -> releaseTool ( m_timer ) . ignore() ; m_timer = 0 ; } 00187 m_toolSvc -> release () ; 00188 m_toolSvc = 0 ; 00189 } 00190 if ( 0 != m_appMgr ) { m_appMgr -> release () ; m_appMgr = 0 ; } 00191 // clear the map 00192 m_map.clear() ; 00193 // finalize the base class 00194 return Auditor::finalize () ; 00195 }
| 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 93 of file TimingAuditor.cpp.
int TimingAuditor::m_indent [private] |
bool TimingAuditor::m_inEvent [private] |
bool TimingAuditor::m_goodForDOD [private] |
MapUser TimingAuditor::m_mapUser [private] |