| # Gaudi Framework, version v25r0 |

Home |  | Generated: Mon Feb 17 2014

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
TimingAuditor Class Reference

Simple auditor which uses SequencerTimerTool for ALL algorithms, including the algorithm from main Gaudi "TopAlg" list and algorithms managed by Data-On-Demand Service. More...

Inheritance diagram for TimingAuditor:
[legend]
Collaboration diagram for TimingAuditor:
[legend]

## 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
Public Member Functions inherited from extends1< Auditor, IIncidentListener >
| extends1 (A1 a1, A2 a2, A3 a3)
| Templated constructor with 3 arguments.
| extends1 (A1 a1, A2 a2)
| Templated constructor with 2 arguments.
| extends1 (A1 a1)
| Templated constructor with 1 argument.
| extends1 ()
| Default constructor.
virtual void * | i_cast (const InterfaceID &tid) const
| Implementation of IInterface::i_cast.
virtual StatusCode | queryInterface (const InterfaceID &ti, void **pp)
| Implementation of IInterface::queryInterface.
virtual std::vector< std::string > | getInterfaceNames () const
| Implementation of IInterface::getInterfaceNames.
virtual | ~extends1 ()
| Virtual destructor.
Public Member Functions inherited from Auditor
| Auditor (const std::string &name, ISvcLocator *svcloc)
| Constructor.
virtual | ~Auditor ()
| Destructor.
StatusCode | sysInitialize ()
| Initialization method invoked by the framework.
StatusCode | sysFinalize ()
| Finalization method invoked by the framework.
virtual void | before (StandardEventType, const std::string &)
virtual void | before (CustomEventTypeRef, INamedInterface *)
virtual void | after (StandardEventType, const std::string &, const StatusCode &)
virtual void | after (CustomEventTypeRef, INamedInterface *, const StatusCode &)
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
SmartIF< IMessageSvc > & | msgSvc () const
| The standard message service.
int | outputLevel () const
| Retrieve the output level of current auditor.
void | setOutputLevel (int level)
| Set the output level for current auditor.
SmartIF< ISvcLocator > & | serviceLocator () const
| The standard service locator.
template<class T >
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.
virtual StatusCode | setProperty (const Property &p)
| Set a value of a property of an auditor.
virtual StatusCode | setProperty (const std::string &s)
| Implementation of IProperty::setProperty.
virtual StatusCode | setProperty (const std::string &n, const std::string &v)
| Implementation of IProperty::setProperty.
virtual StatusCode | getProperty (Property *p) const
| Get the value of a property.
virtual const Property & | getProperty (const std::string &name) const
| Get the property by name.
virtual StatusCode | getProperty (const std::string &n, std::string &v) const
| Implementation of IProperty::getProperty.
const std::vector< Property * > & | getProperties () const
| Get all properties.
template<class TYPE >
StatusCode | setProperty (const std::string &name, const TYPE &value)
| set the property form the value
StatusCode | setProperties ()
| Set the auditor's properties.
template<class T >
Property * | declareProperty (const std::string &name, T &property, const std::string &doc="none") const
| Declare the named property.
Public Member Functions inherited from extend_interfaces1< IIncidentListener >
virtual | ~extend_interfaces1 ()
| Virtual destructor.
Public Member Functions inherited from IIncidentListener
| DeclareInterfaceID (IIncidentListener, 2, 0)
| InterfaceID.
Public Member Functions inherited from IInterface
virtual unsigned long | addRef ()=0
| Increment the reference count of Interface instance.
virtual unsigned long | release ()=0
| Release Interface instance.
virtual unsigned long | refCount () const =0
| Current reference count.
virtual | ~IInterface ()
| 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_beforeFinalize (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
bool | m_histoSaved

## Additional Inherited Members
Public Types inherited from extends1< Auditor, IIncidentListener >
typedef extends1 | base_class
| Typedef to this class.
typedef extend_interfaces1 < IIncidentListener > | extend_interfaces_base
| Typedef to the base of this class.
typedef extend_interfaces_base::ext_iids | interfaces
| MPL set of all the implemented interfaces.
Static Public Member Functions inherited from IInterface
static const InterfaceID & | interfaceID ()
| Return an instance of InterfaceID identifying the interface.

## Detailed Description

Simple auditor which uses SequencerTimerTool for ALL algorithms, including the algorithm from main Gaudi "TopAlg" list and algorithms managed by Data-On-Demand Service.

Author
  Vanya BELYAEV ibely.nosp@m.aev@.nosp@m.physi.nosp@m.cs.s.nosp@m.yr.ed.nosp@m.u

Date
  2007-01-31

Definition at line 28 of file TimingAuditor.cpp.

## Member Typedef Documentation

typedef GaudiUtils::VectorMap<const INamedInterface*,int> TimingAuditor::Map
| private

Definition at line 96 of file TimingAuditor.cpp.

typedef GaudiUtils::HashMap<std::string,int> TimingAuditor::MapUser
| private

Definition at line 105 of file TimingAuditor.cpp.

## Constructor & Destructor Documentation

TimingAuditor::TimingAuditor | ( | const std::string & | name,
|  | ISvcLocator * | pSvc
| ) |  |
| inline

standard constructor

Definition at line 57 of file TimingAuditor.cpp.

: base_class ( name , pSvc )
//
, m_toolSvc ( 0 )
, m_incSvc ( 0 )
//
, m_timer ( 0 )
//
, m_appMgr ( 0 )
//
, m_map ( )
, m_indent ( 0 )
, m_inEvent ( false )
, m_goodForDOD ( false )
, m_mapUser ( )
, m_histoSaved ( false )
{
declareProperty ( "OptimizedForDOD" , m_goodForDOD ) ;
} ;

virtual TimingAuditor::~TimingAuditor | ( |  | ) |
| inline virtual

virtual destructor

Definition at line 78 of file TimingAuditor.cpp.

{}

TimingAuditor::TimingAuditor | ( |  | ) |
| private

TimingAuditor::TimingAuditor | ( | const TimingAuditor & |  | ) |
| private

## Member Function Documentation

void TimingAuditor::after | ( | StandardEventType | evt,
|  | INamedInterface * | alg,
|  | const StatusCode & | sc
| ) |  |
| virtual

Reimplemented from Auditor.

Definition at line 215 of file TimingAuditor.cpp.

{
switch (evt) {
case IAuditor::Initialize : i_afterInitialize( alg ); break;
case IAuditor::Execute : i_afterExecute( alg ); break;
default: break;
}
}

void TimingAuditor::after | ( | CustomEventTypeRef | evt,
|  | const std::string & | name,
|  | const StatusCode & | sc
| ) |  |
| virtual

Reimplemented from Auditor.

Definition at line 321 of file TimingAuditor.cpp.

{
// Ignore obvious mistakes
if ( name.empty() && evt.empty() ) { return; }
// look for the user timer in the map
std::string nick = name + ":" + evt;
MapUser::iterator found = m_mapUser.find( nick );
// We cannot do much if the timer is not available
if ( m_mapUser.end() == found ) {
MsgStream log(msgSvc(), this->name());
log << MSG::WARNING << "Trying to stop the measure of the timing for '"
<< nick << "' but it was never started. Check the code"
<< endmsg;
return;
}
m_timer->stop( found->second );
}

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 205 of file TimingAuditor.cpp.

{
switch (evt) {
case IAuditor::Initialize : i_beforeInitialize( alg ); break;
case IAuditor::Execute : i_beforeExecute( alg ); break;
case IAuditor::Finalize : i_beforeFinalize( alg ); break;
default: break;
}
}

void TimingAuditor::before | ( | CustomEventTypeRef | evt,
|  | const std::string & | name
| ) |  |
| virtual

Reimplemented from Auditor.

Definition at line 299 of file TimingAuditor.cpp.

{
// Ignore obvious mistakes
if ( name.empty() && evt.empty() ) { return; }
// look for the user timer in the map
int timer = 0;
std::string nick = name + ":" + evt;
MapUser::iterator found = m_mapUser.find( nick );
if ( m_mapUser.end() == found ) {
// add a new timer if not yet available
timer = m_timer->addTimer( nick ) ;
m_mapUser[nick] = timer;
}
else {
timer = found->second;
}
m_timer->start( timer );
}

StatusCode TimingAuditor::finalize | ( |  | ) |
| virtual

Reimplemented from Auditor.

Definition at line 179 of file TimingAuditor.cpp.

{
if ( 0 != m_incSvc )
{
m_incSvc -> removeListener ( this , IncidentType::BeginEvent ) ;
m_incSvc -> removeListener ( this , IncidentType::EndEvent ) ;
m_incSvc -> release () ;
m_incSvc = 0 ;
}
if ( 0 != m_toolSvc )
{
// the 2 following line are commented out: it is
// is a temporary hack which prevent a crash due to a problem in
// the reference counting
// if ( 0 != m_timer )
// { m_toolSvc -> releaseTool ( m_timer ) . ignore() ; m_timer = 0 ; }
m_toolSvc -> release () ;
m_toolSvc = 0 ;
}
if ( 0 != m_appMgr ) { m_appMgr -> release () ; m_appMgr = 0 ; }
// clear the map
m_map.clear() ;
// finalize the base class
return Auditor::finalize () ;
}

void TimingAuditor::handle | ( | const Incident & | i | ) |
| virtual

Inform that a new incident has occurred.

Implements IIncidentListener.

Definition at line 341 of file TimingAuditor.cpp.

{
if ( IncidentType::BeginEvent == i.type () )
{
m_timer -> start ( m_map[ m_appMgr ] ) ;
++m_indent ;
m_inEvent = true ;
}
else if ( IncidentType::EndEvent == i.type () )
{
m_timer -> stop ( m_map[ m_appMgr ] ) ;
--m_indent ;
m_inEvent = false ;
}
}

void TimingAuditor::i_afterExecute | ( | INamedInterface * | alg | ) |
| private

Definition at line 290 of file TimingAuditor.cpp.

{
if ( 0 == alg ) { return ; }
Map::iterator found = m_map.find( alg ) ;
if ( m_map.end() == found ) { return ; }
m_timer->stop( found->second ) ;
--m_indent ;
}

void TimingAuditor::i_afterInitialize | ( | INamedInterface * | alg | ) |
| private

Definition at line 259 of file TimingAuditor.cpp.

{
if ( m_goodForDOD ) { return ; }
if ( 0 == alg ) { return ; }
--m_indent ;
}

void TimingAuditor::i_beforeExecute | ( | INamedInterface * | alg | ) |
| private

Definition at line 266 of file TimingAuditor.cpp.

{
if ( 0 == alg ) { return ; }
++m_indent ;
Map::iterator found = m_map.find( alg ) ;
if ( m_map.end() == found )
{
MsgStream log( msgSvc() , name() ) ;
log << MSG::DEBUG
<< "Insert non-structural component '"
<< alg->name() << "' of type '"
<< System::typeinfoName(typeid(*alg)) << "' at level "
<< m_indent << endmsg ;
std::string nick = alg->name() ;
if ( 0 < m_indent ) { nick = std::string ( m_indent , ' ') + nick ; }
if ( !m_goodForDOD ) { nick[0]='*' ;}
int timer = m_timer->addTimer( nick ) ;
m_map.insert ( alg , timer ) ;
m_timer->start( timer ) ;
return ;
}
m_timer->start( found->second ) ;
}

void TimingAuditor::i_beforeFinalize | ( | INamedInterface * | alg | ) |
| private

Definition at line 224 of file TimingAuditor.cpp.

{
if (!m_histoSaved)
{
m_timer->saveHistograms();
m_histoSaved = true;
}
}

void TimingAuditor::i_beforeInitialize | ( | INamedInterface * | alg | ) |
| private

Definition at line 234 of file TimingAuditor.cpp.

{
if ( m_goodForDOD ) { return ; }
//
if ( 0 == alg ) { return ; }
Map::iterator found = m_map.find( alg ) ;
if ( m_map.end() != found ) { return ; }
++m_indent ;
std::string nick = alg->name() ;
if ( 0 < m_indent ) { nick = std::string ( m_indent , ' ') + nick ; }
if ( m_inEvent )
{
nick[0] = '*' ;
MsgStream log( msgSvc() , name() ) ;
log << MSG::DEBUG
<< "Insert non-structural component '"
<< alg->name() << "' of type '"
<< System::typeinfoName(typeid(*alg)) << "' at level "
<< m_indent << endmsg ;
}
int timer = m_timer->addTimer( nick ) ;
m_map.insert ( alg , timer ) ;
m_timer->start( timer ) ;
}

StatusCode TimingAuditor::initialize | ( |  | ) |
| virtual

factory:

Reimplemented from Auditor.

Definition at line 118 of file TimingAuditor.cpp.

{
StatusCode sc = Auditor::initialize() ;
if ( sc.isFailure() ) { return sc ; } // RETURN
MsgStream log ( msgSvc() , name() ) ;
// get tool service
if ( 0 == m_toolSvc )
{
sc = Auditor::service ( "ToolSvc" , m_toolSvc ) ;
if ( sc.isFailure() )
{
log << "Could not retrieve 'ToolSvc' " << sc << endmsg ;
return sc ; // RETURN
}
if ( 0 == m_timer )
{
sc = m_toolSvc->retrieveTool
( "SequencerTimerTool/TIMER" , m_timer , this , true ) ;
if ( sc.isFailure() )
{
log << MSG::ERROR
<< "Could not retrieve ISequencerTimerTool" << endmsg ;
return sc ;
}
}
}
// get incident service
if ( 0 == m_incSvc )
{
sc = Auditor::service ( "IncidentSvc" , m_incSvc ) ;
if ( sc.isFailure() )
{
log << MSG::ERROR
<< "Could not retrieve 'IncidentSvc'" << sc << endmsg ;
return sc ;
}
m_incSvc -> addListener ( this , IncidentType::BeginEvent ) ;
m_incSvc -> addListener ( this , IncidentType::EndEvent ) ;
}
// get the application manager
if ( 0 == m_appMgr )
{
sc = Auditor::service ( "ApplicationMgr" , m_appMgr ) ;
if ( sc.isFailure() )
{
log << MSG::ERROR
<< "Could not retrieve 'ApplicationMgr'" << sc << endmsg ;
return sc ;
}
if ( m_map.end() == m_map.find( m_appMgr ) )
{
int timer = m_timer->addTimer( "EVENT LOOP" ) ;
m_map.insert ( m_appMgr , timer ) ;
}
}
//
return StatusCode::SUCCESS ;
}

TimingAuditor& TimingAuditor::operator= | ( | const TimingAuditor & |  | ) |
| private

## Member Data Documentation

INamedInterface* TimingAuditor::m_appMgr
| private

ApplicationManager.

Definition at line 94 of file TimingAuditor.cpp.

bool TimingAuditor::m_goodForDOD
| private

"optimized for DOD"

Definition at line 103 of file TimingAuditor.cpp.

bool TimingAuditor::m_histoSaved
| private

Definition at line 109 of file TimingAuditor.cpp.

IIncidentSvc* TimingAuditor::m_incSvc
| private

incident service

Definition at line 90 of file TimingAuditor.cpp.

int TimingAuditor::m_indent
| private

indentation level

Definition at line 99 of file TimingAuditor.cpp.

bool TimingAuditor::m_inEvent
| private

"In event" flag

Definition at line 101 of file TimingAuditor.cpp.

Map TimingAuditor::m_map
| private

Definition at line 97 of file TimingAuditor.cpp.

MapUser TimingAuditor::m_mapUser
| private

map used to record user timing events

Definition at line 106 of file TimingAuditor.cpp.

ISequencerTimerTool* TimingAuditor::m_timer
| private

the timer tool

Definition at line 92 of file TimingAuditor.cpp.

IToolSvc* TimingAuditor::m_toolSvc
| private

tool service

Definition at line 88 of file TimingAuditor.cpp.

The documentation for this class was generated from the following file:

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v25r0/GaudiAlg/src/components/TimingAuditor.cpp