MAV'RIC
Classes | Public Types | Public Member Functions | Public Attributes
Scheduler_task Class Reference

Task entry. More...

#include <scheduler_task.hpp>

List of all members.

Classes

struct  function
 Prototype of a task function and its argument. More...

Public Types

enum  return_t { RUN_ERROR = -1, RUN_BLOCKED = 0, RUN_SUCCESS = 1 }
 Task return code. More...
enum  run_mode_t { RUN_NEVER, RUN_ONCE, RUN_REGULAR }
 Task run mode. More...
enum  timing_mode_t { PERIODIC_ABSOLUTE, PERIODIC_RELATIVE }
 Task timing mode. More...
enum  priority_t {
  PRIORITY_LOWEST = 0, PRIORITY_LOW = 1, PRIORITY_NORMAL = 2, PRIORITY_HIGH = 3,
  PRIORITY_HIGHEST = 4
}
 Task priority. More...

Public Member Functions

 Scheduler_task (void)
 Default Constructor.
template<typename T >
 Scheduler_task (uint32_t repeat_period, run_mode_t run_mode, timing_mode_t timing_mode, priority_t priority, typename function< T >::type_t task_function, T *task_argument, int32_t task_id)
 Constructor.
void set_run_mode (run_mode_t mode)
 Modifies the run mode of an existing task.
void run_now ()
 Run a task immediately.
void suspend (uint32_t delay)
 Suspends a task.
void change_period (uint32_t repeat_period)
 Modifies the period of execution of an existing task.
int32_t get_id ()
 Returns the ID of the task.
bool execute ()
 Executes tasks and updates statistics.
bool is_due ()
 Checks if the task is due.

Public Attributes

int32_t task_id
 Unique task identifier.
run_mode_t run_mode
 Run mode.
timing_mode_t timing_mode
 Timing mode.
priority_t priority
 Priority.
uint32_t repeat_period
 Period between two calls (us)
uint32_t next_run
 Next execution time.
float execution_time
 Execution time.
float execution_time_avg
 Average execution time.
float execution_time_var
 Variance of execution time.
float execution_time_max
 Maximum execution time.
float delay
 Delay between expected execution and actual execution.
float delay_avg
 Average delay.
float delay_var
 Variance of delay.
float delay_max
 Maximum delay.
uint32_t rt_violations
 Number of Real-time violations, this is incremented each time an execution is skipped.

Detailed Description

Task entry.


Member Enumeration Documentation

Task priority.

Enumerator:
PRIORITY_LOWEST 

Lowest priority.

PRIORITY_LOW 

Low priority.

PRIORITY_NORMAL 

Normal priority.

PRIORITY_HIGH 

High priority.

PRIORITY_HIGHEST 

Highest priority.

Task return code.

Enumerator:
RUN_ERROR 

The task was not not successfully executed.

RUN_BLOCKED 

If a task returns "TASK_RUN_BLOCKED", the scheduler will try to re-run at the next schedule update, and not update "next_run".

RUN_SUCCESS 

The task was successfully executed.

Task run mode.

Enumerator:
RUN_NEVER 

The task will not be executed.

RUN_ONCE 

The task will be executed only once.

RUN_REGULAR 

The task will be executed periodically.

Task timing mode.

Enumerator:
PERIODIC_ABSOLUTE 

The task will be executed according to a fixed schedule (ie. regardless of past delays or realtime violations)

PERIODIC_RELATIVE 

The task will be executed with constant period relative to the last execution.


Constructor & Destructor Documentation

template<typename T >
Scheduler_task::Scheduler_task ( uint32_t  repeat_period,
run_mode_t  run_mode,
timing_mode_t  timing_mode,
priority_t  priority,
typename function< T >::type_t  task_function,
T *  task_argument,
int32_t  task_id 
)

Constructor.

Template Parameters:
TType of the module
Parameters:
repeat_periodRepeat period in us
run_modeRun mode, defined in enum Scheduler_task::run_mode_t
timing_modeTiming mode, defined in Scheduler_task::timing_mode_t
priorityPriority ,defined in Scheduler_task::priority_t
task_functionFunction to call
task_argumentArgument of the funtion to call
task_idID of the task

Member Function Documentation

void Scheduler_task::change_period ( uint32_t  repeat_period)

Modifies the period of execution of an existing task.

Parameters:
repeat_periodNew repeat period (us)

Here is the call graph for this function:

Here is the caller graph for this function:

Executes tasks and updates statistics.

Returns:
True if no real-time violation occured, false otherwise

Returns the ID of the task.

Returns:
task_id

Checks if the task is due.

Returns:
True if the task is due

Modifies the run mode of an existing task.

Parameters:
new_run_modeNew run mode

Here is the caller graph for this function:

void Scheduler_task::suspend ( uint32_t  delay)

Suspends a task.

Parameters:
delayDuration (us)

Here is the caller graph for this function:


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines