|
Gaudi Framework, version v23r2 |
| Home | Generated: Thu Jun 28 2012 |
Service that monitor the time taken by processing of single events using a separate thread. More...
#include <StalledEventMonitor.h>


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. | |
Private Attributes | |
| unsigned int | m_eventTimeout |
| Number of seconds allowed to process a single event. | |
| 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. | |
Service that monitor the time taken by processing of single events using a separate thread.
Definition at line 29 of file StalledEventMonitor.h.
| StalledEventMonitor::StalledEventMonitor | ( | const std::string & | name, |
| ISvcLocator * | svcLoc | ||
| ) |
Constructor.
Definition at line 61 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)"); }
| StalledEventMonitor::~StalledEventMonitor | ( | ) | [virtual] |
| StatusCode StalledEventMonitor::finalize | ( | ) | [virtual] |
Finalization of the service.
Reimplemented from Service.
Definition at line 122 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 111 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 75 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)));
// 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 105 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 116 of file StalledEventMonitor.cpp.
{
if (m_watchdog.get()) m_watchdog->stop();
return StatusCode::SUCCESS;
}
unsigned int StalledEventMonitor::m_eventTimeout [private] |
Number of seconds allowed to process a single event.
Definition at line 55 of file StalledEventMonitor.h.
Pointer to the incident service.
Definition at line 61 of file StalledEventMonitor.h.
Pointer to the watchdog thread that checks for the event timeout.
Definition at line 58 of file StalledEventMonitor.h.