|
ATLAS Offline Software
|
Go to the documentation of this file.
14 #include "GaudiKernel/ServiceHandle.h"
23 #include <sys/types.h>
36 namespace AlgorithmTimerHandler
95 std::cerr <<
"\nNo _POSIX_CPUTIME defined on this system !\n\n";
122 spec.it_interval.tv_sec = 0;
123 spec.it_interval.tv_nsec = 0;
132 scope.m_timer =
this;
141 spec.it_value.tv_sec = 0;
142 spec.it_value.tv_nsec = 0;
143 spec.it_interval.tv_sec = 0;
144 spec.it_interval.tv_nsec = 0;
149 return 1000*ovalue.it_value.tv_sec +
int(ovalue.it_value.tv_nsec/1000000);
160 return 1000*
spec.it_value.tv_sec +
int(
spec.it_value.tv_nsec/1000000);
171 std::ostringstream
os;
173 os <<
" (" << this->
timeout() <<
" msec) reached";
175 ServiceHandle<ICoreDumpSvc>
coreDumpSvc(
"CoreDumpSvc",
"AlgorithmTimer");
183 std::cerr <<
os.str() << std::endl;
AlgorithmTimerConfig
Configuration flags for AlgorithmTimer.
singleton-like access to IMessageSvc via open function and helper
Helper class to create a "scoped cook timer" without having to declare the CookTimer itself within th...
unsigned int m_timeout
timeout in milliseconds
timer_t m_timerid
timer ID
unsigned int timeLeft() const
Returns the time left in milliseconds.
virtual void setCoreDumpInfo(const std::string &name, const std::string &value) override
Set a name/value pair in the core dump record.
void start(ScopedTimer &scope)
Start the timer.
@ USEREALTIME
use real time instead of system time
Efficient realtime timers.
unsigned int stop()
Stop the timer and return the time left in [ms].
void onAlarmThread(sigval_t sv)
Function called by signals delivered via threads.
unsigned int timeout() const
Returns the currently set timeout (in milliseconds)
Some weak symbol referencing magic...
CoreDumpSvc * coreDumpSvc(nullptr)
pointer to CoreDumpSvc
AlgorithmTimer()
no default constructor
virtual std::string dump() const override
Print all core dump records.
void start()
(Re)start the timer with the last timeout used
std::function< void()> callbackFct_t
std::atomic_bool m_active
flag protecting race condition at stop
callbackFct_t m_onAlarm
user callback
Interface of a core dump service.
~AlgorithmTimer()
Destroy and disable the timer.
struct sigevent m_sigevent
for signal handler
Timer that invokes a user callback once the time is reached.