| # Gaudi Framework, version v23r0 |

Home |  | Generated: Mon Jan 30 2012

Public Member Functions | Private Attributes

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

                                                                                      :
      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]`

Destructor.

Definition at line 70 of file StalledEventMonitor.cpp.

                                             {

    }

## Member Function Documentation

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

## 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 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 58 of file StalledEventMonitor.h.

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

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

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines