rtmlib
|
#include <periodicmonitor.h>
Classes | |
struct | Monitor_state |
Public Member Functions | |
RTML_monitor (const useconds_t period) | |
RTML_monitor (const useconds_t period, unsigned int policy, unsigned int priority) | |
int | enable () |
int | disable () |
bool | isRunning () const |
const useconds_t & | getPeriod () const |
void | setPeriod (const useconds_t &p) |
Protected Member Functions | |
virtual void | run ()=0 |
Private Types | |
enum | mon_status { ACTIVATION, RUNNING, DELAY, ABORT, ABORTED, UNACTIVATE } |
Static Private Member Functions | |
static void * | loop (void *) |
Private Attributes | |
pthread_t | thread |
struct RTML_monitor::Monitor_state | m_state |
Periodic monitor.
This class implements a periodic monitor that can execute with the system tasks using a Posix-compliant interface. The monitoring task is seen like any other task in the system.
|
private |
RTML_monitor::RTML_monitor | ( | const useconds_t | period | ) |
Instantiates a new monitor with a given period.
The schedule policy will be SCHED_OTHER with priority 0.
period | the monitors period. |
RTML_monitor::RTML_monitor | ( | const useconds_t | period, |
unsigned int | policy, | ||
unsigned int | priority | ||
) |
Instantiates a new monitor with a given period, a schedule policy and a priority.
period | the RTML_monitor period. |
policy | the posix schedule policy for this monitor. |
priority | the priority for this RTML_monitor. |
int RTML_monitor::disable | ( | ) |
Disables the monitor
f | the function to start the thread with. |
int RTML_monitor::enable | ( | ) |
Enables the monitor
const useconds_t & RTML_monitor::getPeriod | ( | ) | const |
Gets the period.
bool RTML_monitor::isRunning | ( | ) | const |
Checks whether this RTML_monitor is running.
|
staticprivate |
A function pointer for the monitor body. The body content is executed in the run loop and there is also synchronization and deadline miss detection there.
ptr | pointer to the monitor to be executed. |
|
protectedpure virtual |
The monitor execution control body.
Users should overwrite this function with their monitoring function. It will be called periodically as defined by the users scheduling policy.
void RTML_monitor::setPeriod | ( | const useconds_t & | p | ) |
Sets new monitor period.
|
private |
|
private |
Points to the monitor thread in the OS.