| # Gaudi Framework, version v21r9 |

Home |  | Generated: 3 May 2010

# 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]

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< WatchdogThread > | m_watchdog
| Pointer to the watchdog thread that checks for the event timeout.
SmartIF< IIncidentSvc > | m_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.

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

StalledEventMonitor::~StalledEventMonitor | ( |  | ) | `[virtual]`

Destructor.

Definition at line 70 of file StalledEventMonitor.cpp.

    00070                                          {
    00071
    00072 }

## Member Function Documentation

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 }

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::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 }

StatusCode StalledEventMonitor::finalize | ( | void |  | ) | `[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 }

## 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.

std::auto_ptr<WatchdogThread> StalledEventMonitor::m_watchdog`[private]`

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

Definition at line 58 of file StalledEventMonitor.h.

SmartIF<IIncidentSvc> StalledEventMonitor::m_incidentSvc`[private]`

Pointer to the incident service.

Definition at line 61 of file StalledEventMonitor.h.

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

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