Go to the documentation of this file.
20 #include <fmt/format.h>
21 #include <fmt/ostream.h>
23 #include <range/v3/range/conversion.hpp>
24 #include <range/v3/view/remove.hpp>
25 #include <range/v3/view/transform.hpp>
27 #include <string_view>
44 #if FMT_VERSION >= 90000
47 struct fmt::formatter<
EventContext> : ostream_formatter {};
64 return Transformer::initialize().
andThen( [
this] {
65 if ( !service(
"StalledEventMonitor",
false,
true ) ) {
67 auto&
opts = serviceLocator()->getOptsSvc();
70 if (
opts.isSet(
"StalledEventMonitor.MaxTimeoutCount" ) ) {
72 opts.bind(
"StalledEventMonitor", &maxCount );
80 using namespace std::chrono_literals;
84 const bool doStackTrace;
85 const bool abortOnTimeout;
86 const unsigned int timeout;
105 <<
fmt::format(
"Current memory usage is virtual size = {} MB, resident set size = {} MB",
110 std::scoped_lock protectReport( s_watchdogReportMutex );
111 if ( doStackTrace ) {
115 fmt::print( stderr,
"=== Stalled event: current stack trace ({}) ===\n",
ctx );
116 gSystem->StackTrace();
119 if ( abortOnTimeout ) {
138 schedulers = svcLoc()->getServices() |
139 views::transform( [](
auto svc ) {
return Gaudi::Cast<IScheduler>( svc ); } ) |
140 views::remove(
nullptr ) | to<std::vector>();
151 "Number of seconds allowed to process a single event." };
153 "If set to true, the application is killed when we reach the timeout." };
PeriodicAction operator()(EventContext const &ctx) const override
StatusCode andThen(F &&f, ARGS &&... args) const
Chain code blocks making the execution conditional a success result.
Gaudi::CheckedProperty< unsigned int > m_eventTimeout
Helper to periodically run asynchronous tasks.
double * begin(CLHEP::HepVector &v)
Gaudi::Property< bool > m_abortOnTimeout
const ValueType & value() const
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
Add to the transient store a tracker that detects events that are taking too long.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Header file for std:chrono::duration-based Counters.
#define DECLARE_COMPONENT(type)
Gaudi::Property< bool > m_stackTrace
details::Transformer< Signature, Traits_, details::isLegacy< Traits_ > > Transformer
EventWatchdogAlg(const std::string &name, ISvcLocator *pSvcLocator)
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'.
StatusCode initialize() override
GAUDI_API long virtualMemory(MemoryUnit unit=kByte, InfoType fetch=Memory, long pid=-1)
Basic Process Information: priority boost.