26 boost::posix_time::time_duration timeout,
bool stackTrace =
false,
long maxCount = 0,
27 bool autostart =
false )
28 :
WatchdogThread( timeout, autostart ),
log( msgSvc, name ), m_maxCount( maxCount ), m_stackTrace( stackTrace )
31 ~EventWatchdog()
override =
default;
41 bool m_stackTrace =
false;
47 << IncidentType::BeginEvent <<
endmsg;
51 log <<
MSG::INFO <<
"Current memory usage is" 54 ", resident set size = " 56 if ( m_stackTrace && gSystem ) {
59 gSystem->StackTrace();
62 if ( m_maxCount > 0 && m_counter >= m_maxCount ) {
63 log <<
MSG::FATAL <<
"too much time on a single event: aborting process" <<
endmsg;
71 log <<
MSG::INFO <<
"Starting a new event after ~" << m_counter *
getTimeout().total_seconds() <<
"s" 99 static const std::string serviceName =
"IncidentSvc";
102 error() <<
"Cannot retrieve " << serviceName <<
endmsg;
105 debug() <<
"Register to the IncidentSvc" <<
endmsg;
108 warning() <<
"StalledEventMonitor/" <<
name() <<
" instantiated with 0 time-out: no monitoring performed" <<
endmsg;
142 return base_class::finalize();
Definition of the MsgStream class used to transmit messages.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
StatusCode stop() override
Stop the watchdog thread (after the event loop).
const std::string & name() const override
Retrieve name of the service.
boost::posix_time::time_duration getTimeout() const
Get the current time-out value.
void start()
Start the watchdog thread.
virtual void onStop()
User implemented function that will be called when stopping.
Gaudi::Property< unsigned int > m_eventTimeout
std::unique_ptr< WatchdogThread > m_watchdog
Pointer to the watchdog thread that checks for the event timeout.
void handle(const Incident &) override
Notify the watchdog thread for a new event.
StatusCode start() override
Start the watchdog thread (before entering the event loop).
void ping()
Function to call to notify the watchdog thread that we are still alive.
bool isFailure() const
Test for a status code of FAILURE.
#define DECLARE_COMPONENT(type)
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Service that monitor the time taken by processing of single events using a separate thread...
SmartIF< IIncidentSvc > m_incidentSvc
Pointer to the incident service.
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
This class is used for returning status codes from appropriate routines.
StalledEventMonitor(const std::string &name, ISvcLocator *svcLoc)
Constructor.
virtual void onPing()
User implemented function that will be called when ping is called.
StatusCode initialize() override
Initialization of the service.
Simple class for asynchronous check of time-out.
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
void stop()
Signal the watchdog thread to stop and wait for it.
Base class for all Incidents (computing events).
virtual void addListener(IIncidentListener *lis, const std::string &type="", long priority=0, bool rethrow=false, bool singleShot=false)=0
Add listener.
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
GAUDI_API long virtualMemory(MemoryUnit unit=kByte, InfoType fetch=Memory, long pid=-1)
Basic Process Information: priority boost.
StatusCode finalize() override
Finalization of the service.
void reset(TYPE *ptr=nullptr)
Set the internal pointer to the passed one disposing of the old one.
virtual void removeListener(IIncidentListener *lis, const std::string &type="")=0
Remove listener.
virtual void action()
User implemented function that will be called if the time-out is reached.
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
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'...
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Gaudi::Property< int > m_maxTimeoutCount