Go to the documentation of this file.
32 bool stackTrace =
false,
long maxCount = 0,
bool autostart =
false )
35 , m_maxCount( maxCount )
36 , m_stackTrace( stackTrace ) {}
46 bool m_stackTrace =
false;
56 <<
"Current memory usage is"
60 ", resident set size = "
62 if ( m_stackTrace && gSystem ) {
65 gSystem->StackTrace();
68 if ( m_maxCount > 0 && m_counter >= m_maxCount ) {
92 warning() <<
"the service StalledEventMonitor is deprecated, please use Gaudi::EventWatchdogAlg" <<
endmsg;
100 static const std::string serviceName =
"IncidentSvc";
103 error() <<
"Cannot retrieve " << serviceName <<
endmsg;
106 debug() <<
"Register to the IncidentSvc" <<
endmsg;
107 m_incidentSvc->addListener(
this, IncidentType::BeginEvent );
109 warning() <<
"StalledEventMonitor/" <<
name() <<
" instantiated with 0 time-out: no monitoring performed" <<
endmsg;
137 m_incidentSvc->removeListener(
this, IncidentType::BeginEvent );
139 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.
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.
std::chrono::seconds getTimeout() const
Get the current time-out value.
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