X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Scheduler%2FScheduler.hh;h=fdd5f59360c8c6f8439a9b346b30e14eec496117;hb=4e05bff7db89ed83bfe3846c56273c7c91c6be59;hp=af07c48de994bbe8dbacc2e40e5dcc4d6ab04e95;hpb=9348e1098d66ac2684c8e280abf8d7143c887982;p=senf.git diff --git a/Scheduler/Scheduler.hh b/Scheduler/Scheduler.hh index af07c48..fdd5f59 100644 --- a/Scheduler/Scheduler.hh +++ b/Scheduler/Scheduler.hh @@ -24,14 +24,15 @@ \brief Scheduler public header */ -#ifndef HH_Scheduler_ -#define HH_Scheduler_ 1 +#ifndef HH_SENF_Scheduler_Scheduler_ +#define HH_SENF_Scheduler_Scheduler_ 1 // Custom includes #include "../Utils/Logger/SenfLog.hh" #include "FdEvent.hh" #include "TimerEvent.hh" #include "SignalEvent.hh" +#include "EventHook.hh" //#include "scheduler.mpp" ///////////////////////////////hh.p//////////////////////////////////////// @@ -64,6 +65,7 @@ namespace senf { \li senf::scheduler::FdEvent for file descriptor events \li senf::scheduler::TimerEvent for single-shot deadline timer events \li senf::scheduler::SignalEvent for UNIX signal events + \li senf::scheduler::EventHook for a special event hook These instance are owned and managed by the user of the scheduler \e not by the scheduler so the RAII concept can be used. @@ -230,6 +232,32 @@ namespace scheduler { /** \brief Number of watchdog events */ unsigned hangCount(); + /** \brief Switch to using hi resolution timers + + By default, timers are implemented directly using epoll. This however restricts the timer + resolution to that of the kernel HZ value. + + High resolution timers are implemented either using POSIX timers or, when available, using + the Linux special \c timerfd() syscall. + + POSIX timers are delivered using signals. A high timer load this increases the signal load + considerably. \c timerfd()'s are delivered on a file descriptor and thus don't have such a + scalability issue. + + \warning The timer source must not be switched from a scheduler callback + */ + void hiresTimers(); + + /** \brief Switch back to using epoll for timing + \see hiresTimers() + */ + void loresTimers(); + + /** \brief return \c true, if \c timerfd() timing is available, \c false otherwise + \see hiresTimers() + */ + bool haveScalableHiresTimers(); + /** \brief Restart scheduler This call will restart all scheduler dispatchers (timers, signals, file descriptors). This