Go to the documentation of this file.
34 boost::posix_time::time_duration timeout,
bool stackTrace =
false,
long maxCount = 0,
35 bool autostart =
false )
38 , m_maxCount( maxCount )
39 , m_stackTrace( stackTrace ) {}
49 bool m_stackTrace =
false;
54 << IncidentType::BeginEvent <<
endmsg;
59 <<
"Current memory usage is"
63 ", resident set size = "
65 if ( m_stackTrace && gSystem ) {
68 gSystem->StackTrace();
71 if ( m_maxCount > 0 && m_counter >= m_maxCount ) {
103 static const std::string serviceName =
"IncidentSvc";
106 error() <<
"Cannot retrieve " << serviceName <<
endmsg;
109 debug() <<
"Register to the IncidentSvc" <<
endmsg;
110 m_incidentSvc->addListener(
this, IncidentType::BeginEvent );
112 warning() <<
"StalledEventMonitor/" <<
name() <<
" instantiated with 0 time-out: no monitoring performed" <<
endmsg;
140 m_incidentSvc->removeListener(
this, IncidentType::BeginEvent );
142 return base_class::finalize();
void stop()
Signal the watchdog thread to stop and wait for it.
void ping()
Function to call to notify the watchdog thread that we are still alive.
void reset(TYPE *ptr=nullptr)
Set the internal pointer to the passed one disposing of the old one.
Service that monitor the time taken by processing of single events using a separate thread.
virtual void onPing()
User implemented function that will be called when ping is called.
boost::posix_time::time_duration getTimeout() const
Get the current time-out value.
StatusCode initialize() override
Initialization of the service.
void start()
Start the watchdog thread.
const std::string & name() const override
Retrieve name of the service
StatusCode finalize() override
Finalization of the service.
Gaudi::Property< unsigned int > m_eventTimeout
virtual void action()
User implemented function that will be called if the time-out is reached.
const ValueType & value() const
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Gaudi::Property< int > m_maxTimeoutCount
void handle(const Incident &) override
Notify the watchdog thread for a new event.
constexpr static const auto SUCCESS
std::unique_ptr< WatchdogThread > m_watchdog
Pointer to the watchdog thread that checks for the event timeout.
StatusCode stop() override
Stop the watchdog thread (after the event loop).
#define DECLARE_COMPONENT(type)
SmartIF< IIncidentSvc > m_incidentSvc
Pointer to the incident service.
Gaudi::Property< bool > m_stackTrace
virtual void onStop()
User implemented function that will be called when stopping.
constexpr static const auto FAILURE
GAUDI_API long pagedMemory(MemoryUnit unit=kByte, InfoType fetch=Memory, long pid=-1)
Basic Process Information: Amount of paged memory currently occupied by the process 'pid'.
GAUDI_API long virtualMemory(MemoryUnit unit=kByte, InfoType fetch=Memory, long pid=-1)
Basic Process Information: priority boost.
StatusCode start() override
Start the watchdog thread (before entering the event loop).
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator