Gaudi Framework, version v22r0

Home   Generated: 9 Feb 2011

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:
Inheritance graph
[legend]
Collaboration diagram for StalledEventMonitor:
Collaboration graph
[legend]

List of all members.

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< WatchdogThreadm_watchdog
 Pointer to the watchdog thread that checks for the event timeout.
SmartIF< IIncidentSvcm_incidentSvc
 Pointer to the incident service.

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 61 of file StalledEventMonitor.cpp.

00062                                                                                   :
00063   base_class(name, svcLoc) {
00064 
00065   declareProperty("EventTimeout", m_eventTimeout = 600,
00066                   "Number of seconds allowed to process a single event (0 to disable the check)");
00067 
}

StalledEventMonitor::~StalledEventMonitor (  )  [virtual]

Destructor.

Definition at line 70 of file StalledEventMonitor.cpp.

00070                                          {
00071 
00072 }


Member Function Documentation

StatusCode StalledEventMonitor::finalize (  )  [virtual]

Finalization of the service.

Reimplemented from Service.

Definition at line 122 of file StalledEventMonitor.cpp.

00122                                          {
00123   // destroy the watchdog thread (if any)
00124   m_watchdog.reset();
00125   // unregistering from the IncidentSvc
00126   m_incidentSvc->removeListener(this, IncidentType::BeginEvent);
00127   m_incidentSvc.reset();
00128   return base_class::finalize();
00129 }

void StalledEventMonitor::handle ( const Incident  )  [virtual]

Notify the watchdog thread for a new event.

Implements IIncidentListener.

Definition at line 111 of file StalledEventMonitor.cpp.

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

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.

00075                                            {
00076   StatusCode sc = base_class::initialize();
00077   if (sc.isFailure()) return sc;
00078 
00079 
00080   if (m_eventTimeout) {
00081     // create the watchdog thread
00082     m_watchdog = std::auto_ptr<WatchdogThread>(
00083         new EventWatchdog(msgSvc(),
00084             "EventWatchdog",
00085             boost::posix_time::seconds(m_eventTimeout)));
00086 
00087     // register to the incident service
00088     std::string serviceName = "IncidentSvc";
00089     m_incidentSvc = serviceLocator()->service(serviceName);
00090     if ( ! m_incidentSvc ) {
00091       error() << "Cannot retrieve " << serviceName << endmsg;
00092       return StatusCode::FAILURE;
00093     }
00094     debug() << "Register to the IncidentSvc" << endmsg;
00095     m_incidentSvc->addListener(this, IncidentType::BeginEvent);
00096   } else {
00097     warning() << "StalledEventMonitor/" << name()
00098        << " instantiated with 0 time-out: no monitoring performed" << endmsg;
00099   }
00100 
00101   return StatusCode::SUCCESS;
00102 }

StatusCode StalledEventMonitor::start (  )  [virtual]

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

Reimplemented from Service.

Definition at line 105 of file StalledEventMonitor.cpp.

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

StatusCode StalledEventMonitor::stop (  )  [virtual]

Stop the watchdog thread (after the event loop).

Reimplemented from Service.

Definition at line 116 of file StalledEventMonitor.cpp.

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


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.

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.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines

Generated at Wed Feb 9 16:31:52 2011 for Gaudi Framework, version v22r0 by Doxygen version 1.6.2 written by Dimitri van Heesch, © 1997-2004