| # 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 Attributes | List of all members
StalledEventMonitor Class Reference

Service that monitor the time taken by processing of single events using a separate thread. More...

`#include <StalledEventMonitor.h>`

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

## Public Member Functions
| StalledEventMonitor (const std::string &name, ISvcLocator *svcLoc)
| Constructor.
virtual | ~StalledEventMonitor ()
| Destructor.
virtual StatusCode | initialize ()
| Initialization of the service.
virtual StatusCode | start ()
| Start the watchdog thread (before entering the event loop).
virtual void | handle (const Incident &)
| Notify the watchdog thread for a new event.
virtual StatusCode | stop ()
| Stop the watchdog thread (after the event loop).
virtual StatusCode | finalize ()
| Finalization of the service.
Public Member Functions inherited from extends1< Service, 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 Service
virtual unsigned long | release ()
| Release Interface instance.
virtual const std::string & | name () const
| Retrieve name of the service.
virtual StatusCode | configure ()
virtual StatusCode | terminate ()
virtual Gaudi::StateMachine::State | FSMState () const
virtual Gaudi::StateMachine::State | targetFSMState () const
virtual StatusCode | reinitialize ()
virtual StatusCode | restart ()
virtual StatusCode | sysInitialize ()
| Initialize Service.
virtual StatusCode | sysStart ()
| Initialize Service.
virtual StatusCode | sysStop ()
| Initialize Service.
virtual StatusCode | sysFinalize ()
| Finalize Service.
virtual StatusCode | sysReinitialize ()
| Re-initialize the Service.
virtual StatusCode | sysRestart ()
| Re-initialize the Service.
virtual StatusCode | setProperty (const Property &p)
virtual StatusCode | setProperty (const std::string &s)
virtual StatusCode | setProperty (const std::string &n, const std::string &v)
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
virtual const std::vector < Property * > & | getProperties () const
template<class TYPE >
StatusCode | setProperty (const std::string &name, const TYPE &value)
| set the property form the value
| Service (const std::string &name, ISvcLocator *svcloc)
| Standard Constructor.
SmartIF< ISvcLocator > & | serviceLocator () const
| Retrieve pointer to service locator.
StatusCode | setProperties ()
| Method for setting declared properties to the values specified for the job.
template<class T >
StatusCode | service (const std::string &name, const T *&psvc, bool createIf=true) const
| Access a service by name, creating it if it doesn't already exist.
template<class T >
StatusCode | service (const std::string &name, T *&psvc, bool createIf=true) const
template<class T >
StatusCode | service (const std::string &svcType, const std::string &svcName, T *&psvc) const
| Access a service by name and type, creating it if it doesn't already exist.
template<class T >
Property * | declareProperty (const std::string &name, T &property, const std::string &doc="none") const
| Declare the named property.
Property * | declareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const
| Declare remote named properties.
SmartIF< IAuditorSvc > & | auditorSvc () const
| The standard auditor service.May not be invoked before sysInitialize() has been invoked.
Public Member Functions inherited from CommonMessaging< implements3< IService, IProperty, IStateful > >
| CommonMessaging (const A1 &a1, const A2 &a2, const A3 &a3)
| Templated constructor with 3 arguments.
| CommonMessaging (const A1 &a1, const A2 &a2)
| Templated constructor with 2 arguments.
| CommonMessaging (const A1 &a1)
| Templated constructor with 1 argument.
| CommonMessaging ()
| Default constructor.
virtual | ~CommonMessaging ()
| Virtual destructor.
SmartIF< IMessageSvc > & | msgSvc () const
| The standard message service.
MsgStream & | msgStream () const
| Return an uninitialized MsgStream.
MsgStream & | msgStream (const MSG::Level level) const
| Predefined configurable message stream for the efficient printouts.
MsgStream & | always () const
| shortcut for the method msgStream(MSG::ALWAYS)
MsgStream & | fatal () const
| shortcut for the method msgStream(MSG::FATAL)
MsgStream & | err () const
| shortcut for the method msgStream(MSG::ERROR)
MsgStream & | error () const
| shortcut for the method msgStream(MSG::ERROR)
MsgStream & | warning () const
| shortcut for the method msgStream(MSG::WARNING)
MsgStream & | info () const
| shortcut for the method msgStream(MSG::INFO)
MsgStream & | debug () const
| shortcut for the method msgStream(MSG::DEBUG)
MsgStream & | verbose () const
| shortcut for the method msgStream(MSG::VERBOSE)
MsgStream & | msg () const
| shortcut for the method msgStream(MSG::INFO)
MSG::Level | msgLevel () const
| get the output level from the embedded MsgStream
bool | msgLevel (MSG::Level lvl) const
| get the output level from the embedded MsgStream
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 Attributes
unsigned int | m_eventTimeout
| Number of seconds allowed to process a single event.
int | m_maxTimeoutCount
| Number timeouts before aborting the execution (0 means never abort).
bool | m_stackTrace
| Whether to print a stack-trace on timeout.
std::auto_ptr< WatchdogThread > | m_watchdog
| Pointer to the watchdog thread that checks for the event timeout.
SmartIF< IIncidentSvc > | m_incidentSvc
| Pointer to the incident service.

## Additional Inherited Members
Public Types inherited from extends1< Service, 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.
Protected Member Functions inherited from Service
virtual | ~Service ()
| Standard Destructor.
int | outputLevel () const
| get the `Service's` output level
Protected Attributes inherited from Service
IntegerProperty | m_outputLevel
| Service output level.
Gaudi::StateMachine::State | m_state
| Service state.
Gaudi::StateMachine::State | m_targetState
| Service state.

## Detailed Description

Service that monitor the time taken by processing of single events using a separate thread.

See Also
  WatchdogThread

Author
  Marco Clemencic

Date
  Apr 19, 2010

Definition at line 29 of file StalledEventMonitor.h.

## Constructor & Destructor Documentation

StalledEventMonitor::StalledEventMonitor | ( | const std::string & | name,
|  | ISvcLocator * | svcLoc
| ) |  |

Constructor.

Definition at line 85 of file StalledEventMonitor.cpp.

:
base_class(name, svcLoc) {
declareProperty("EventTimeout", m_eventTimeout = 600,
"Number of seconds allowed to process a single event (0 to disable the check).");
declareProperty("MaxTimeoutCount", m_maxTimeoutCount = 0,
"Number timeouts before aborting the execution (0 means never abort).");
declareProperty("StackTrace", m_stackTrace = false,
"Whether to print the stack-trace on timeout.");
}

StalledEventMonitor::~StalledEventMonitor | ( |  | ) |
| virtual

Destructor.

Definition at line 99 of file StalledEventMonitor.cpp.

{
}

## Member Function Documentation

StatusCode StalledEventMonitor::finalize | ( |  | ) |
| virtual

Finalization of the service.

Reimplemented from Service.

Definition at line 153 of file StalledEventMonitor.cpp.

{
// destroy the watchdog thread (if any)
m_watchdog.reset();
// unregistering from the IncidentSvc
m_incidentSvc->removeListener(this, IncidentType::BeginEvent);
m_incidentSvc.reset();
return base_class::finalize();
}

void StalledEventMonitor::handle | ( | const Incident & |  | ) |
| virtual

Notify the watchdog thread for a new event.

Implements IIncidentListener.

Definition at line 142 of file StalledEventMonitor.cpp.

{
if (m_watchdog.get()) m_watchdog->ping();
}

StatusCode StalledEventMonitor::initialize | ( |  | ) |
| virtual

Initialization of the service.

Prepare the watchdog thread and configures it.

Reimplemented from Service.

Definition at line 104 of file StalledEventMonitor.cpp.

{
StatusCode sc = base_class::initialize();
if (sc.isFailure()) return sc;
if (m_eventTimeout) {
// create the watchdog thread
m_watchdog = std::auto_ptr<WatchdogThread>(
new EventWatchdog(msgSvc(),
"EventWatchdog",
boost::posix_time::seconds(m_eventTimeout),
m_stackTrace,
m_maxTimeoutCount));
// register to the incident service
std::string serviceName = "IncidentSvc";
m_incidentSvc = serviceLocator()->service(serviceName);
if ( ! m_incidentSvc ) {
error() << "Cannot retrieve " << serviceName << endmsg;
return StatusCode::FAILURE;
}
debug() << "Register to the IncidentSvc" << endmsg;
m_incidentSvc->addListener(this, IncidentType::BeginEvent);
} else {
warning() << "StalledEventMonitor/" << name()
<< " instantiated with 0 time-out: no monitoring performed" << endmsg;
}
return StatusCode::SUCCESS;
}

StatusCode StalledEventMonitor::start | ( |  | ) |
| virtual

Start the watchdog thread (before entering the event loop).

Reimplemented from Service.

Definition at line 136 of file StalledEventMonitor.cpp.

{
if (m_watchdog.get()) m_watchdog->start();
return StatusCode::SUCCESS;
}

StatusCode StalledEventMonitor::stop | ( |  | ) |
| virtual

Stop the watchdog thread (after the event loop).

Reimplemented from Service.

Definition at line 147 of file StalledEventMonitor.cpp.

{
if (m_watchdog.get()) m_watchdog->stop();
return StatusCode::SUCCESS;
}

## Member Data Documentation

unsigned int StalledEventMonitor::m_eventTimeout
| private

Number of seconds allowed to process a single event.

Definition at line 55 of file StalledEventMonitor.h.

SmartIF<IIncidentSvc> StalledEventMonitor::m_incidentSvc
| private

Pointer to the incident service.

Definition at line 67 of file StalledEventMonitor.h.

int StalledEventMonitor::m_maxTimeoutCount
| private

Number timeouts before aborting the execution (0 means never abort).

Definition at line 58 of file StalledEventMonitor.h.

bool StalledEventMonitor::m_stackTrace
| private

Whether to print a stack-trace on timeout.

Definition at line 61 of file StalledEventMonitor.h.

std::auto_ptr<WatchdogThread> StalledEventMonitor::m_watchdog
| private

Pointer to the watchdog thread that checks for the event timeout.

Definition at line 64 of file StalledEventMonitor.h.

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

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v25r0/GaudiUtils/src/component/StalledEventMonitor.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v25r0/GaudiUtils/src/component/StalledEventMonitor.cpp