APM:Libraries
Classes | Public Member Functions | Public Attributes | Static Public Attributes | Private Attributes | List of all members
AP_Scheduler Class Reference

#include <AP_Scheduler.h>

Collaboration diagram for AP_Scheduler:
[legend]

Classes

struct  Task
 

Public Member Functions

 FUNCTOR_TYPEDEF (scheduler_fastloop_fn_t, void)
 
 AP_Scheduler (scheduler_fastloop_fn_t fastloop_fn=nullptr)
 
 AP_Scheduler (const AP_Scheduler &other)=delete
 
AP_Scheduleroperator= (const AP_Scheduler &)=delete
 
 FUNCTOR_TYPEDEF (task_fn_t, void)
 
void init (const Task *tasks, uint8_t num_tasks, uint32_t log_performance_bit)
 
void loop ()
 
void update_logging ()
 
void Log_Write_Performance ()
 
void tick (void)
 
uint16_t ticks () const
 
void run (uint32_t time_available)
 
uint16_t time_available_usec (void)
 
uint8_t debug_flags (void)
 
float load_average ()
 
uint16_t get_loop_rate_hz (void)
 
uint32_t get_loop_period_us ()
 
float get_loop_period_s ()
 
float get_filtered_loop_time (void) const
 
float get_last_loop_time_s (void) const
 

Public Attributes

AP::PerfInfo perf_info
 

Static Public Attributes

static const struct AP_Param::GroupInfo var_info []
 
static int8_t current_task = -1
 

Private Attributes

scheduler_fastloop_fn_t _fastloop_fn
 
AP_Int8 _debug
 
AP_Int16 _loop_rate_hz
 
AP_Int16 _active_loop_rate_hz
 
uint16_t _loop_period_us
 
float _loop_period_s
 
const struct Task_tasks
 
uint8_t _num_tasks
 
uint16_t _tick_counter
 
uint16_t * _last_run
 
uint32_t _task_time_allowed
 
uint32_t _task_time_started
 
uint32_t _spare_micros
 
uint8_t _spare_ticks
 
uint32_t _loop_timer_start_us
 
float _last_loop_time_s
 
AP_HAL::Util::perf_counter_t_perf_counters
 
uint32_t _log_performance_bit
 

Detailed Description

Definition at line 53 of file AP_Scheduler.h.

Constructor & Destructor Documentation

◆ AP_Scheduler() [1/2]

AP_Scheduler::AP_Scheduler ( scheduler_fastloop_fn_t  fastloop_fn = nullptr)

Definition at line 63 of file AP_Scheduler.cpp.

Here is the call graph for this function:

◆ AP_Scheduler() [2/2]

AP_Scheduler::AP_Scheduler ( const AP_Scheduler other)
delete

Member Function Documentation

◆ debug_flags()

uint8_t AP_Scheduler::debug_flags ( void  )
inline

Definition at line 102 of file AP_Scheduler.h.

Referenced by update_logging().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FUNCTOR_TYPEDEF() [1/2]

AP_Scheduler::FUNCTOR_TYPEDEF ( scheduler_fastloop_fn_t  ,
void   
)

◆ FUNCTOR_TYPEDEF() [2/2]

AP_Scheduler::FUNCTOR_TYPEDEF ( task_fn_t  ,
void   
)

◆ get_filtered_loop_time()

float AP_Scheduler::get_filtered_loop_time ( void  ) const
inline

Definition at line 131 of file AP_Scheduler.h.

Here is the call graph for this function:

◆ get_last_loop_time_s()

float AP_Scheduler::get_last_loop_time_s ( void  ) const
inline

Definition at line 136 of file AP_Scheduler.h.

◆ get_loop_period_s()

float AP_Scheduler::get_loop_period_s ( )
inline

Definition at line 124 of file AP_Scheduler.h.

Referenced by loop().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_loop_period_us()

uint32_t AP_Scheduler::get_loop_period_us ( )
inline

Definition at line 117 of file AP_Scheduler.h.

Referenced by load_average(), and loop().

Here is the caller graph for this function:

◆ get_loop_rate_hz()

uint16_t AP_Scheduler::get_loop_rate_hz ( void  )
inline

Definition at line 110 of file AP_Scheduler.h.

Referenced by init(), SchedTest::setup(), and update_logging().

Here is the caller graph for this function:

◆ init()

void AP_Scheduler::init ( const Task tasks,
uint8_t  num_tasks,
uint32_t  log_performance_bit 
)

Definition at line 78 of file AP_Scheduler.cpp.

Referenced by SchedTest::setup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_average()

float AP_Scheduler::load_average ( )

Definition at line 206 of file AP_Scheduler.cpp.

Referenced by debug_flags(), and Log_Write_Performance().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Log_Write_Performance()

void AP_Scheduler::Log_Write_Performance ( )

Definition at line 273 of file AP_Scheduler.cpp.

Referenced by update_logging().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ loop()

void AP_Scheduler::loop ( void  )

Definition at line 216 of file AP_Scheduler.cpp.

Referenced by SchedTest::loop().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=()

AP_Scheduler& AP_Scheduler::operator= ( const AP_Scheduler )
delete

◆ run()

void AP_Scheduler::run ( uint32_t  time_available)

Definition at line 103 of file AP_Scheduler.cpp.

Referenced by loop(), and ticks().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tick()

void AP_Scheduler::tick ( void  )

Definition at line 94 of file AP_Scheduler.cpp.

Referenced by loop().

Here is the caller graph for this function:

◆ ticks()

uint16_t AP_Scheduler::ticks ( ) const
inline

Definition at line 91 of file AP_Scheduler.h.

Here is the call graph for this function:

◆ time_available_usec()

uint16_t AP_Scheduler::time_available_usec ( void  )

Definition at line 194 of file AP_Scheduler.cpp.

Referenced by ticks().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ update_logging()

void AP_Scheduler::update_logging ( )

Definition at line 259 of file AP_Scheduler.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ _active_loop_rate_hz

AP_Int16 AP_Scheduler::_active_loop_rate_hz
private

Definition at line 159 of file AP_Scheduler.h.

Referenced by get_loop_rate_hz().

◆ _debug

AP_Int8 AP_Scheduler::_debug
private

Definition at line 153 of file AP_Scheduler.h.

Referenced by debug_flags(), and run().

◆ _fastloop_fn

scheduler_fastloop_fn_t AP_Scheduler::_fastloop_fn
private

Definition at line 150 of file AP_Scheduler.h.

Referenced by loop().

◆ _last_loop_time_s

float AP_Scheduler::_last_loop_time_s
private

Definition at line 196 of file AP_Scheduler.h.

Referenced by AP_Scheduler(), get_last_loop_time_s(), and loop().

◆ _last_run

uint16_t* AP_Scheduler::_last_run
private

Definition at line 178 of file AP_Scheduler.h.

Referenced by init(), and run().

◆ _log_performance_bit

uint32_t AP_Scheduler::_log_performance_bit
private

Definition at line 202 of file AP_Scheduler.h.

Referenced by init(), and update_logging().

◆ _loop_period_s

float AP_Scheduler::_loop_period_s
private

Definition at line 165 of file AP_Scheduler.h.

Referenced by get_loop_period_s().

◆ _loop_period_us

uint16_t AP_Scheduler::_loop_period_us
private

Definition at line 162 of file AP_Scheduler.h.

Referenced by get_loop_period_us().

◆ _loop_rate_hz

AP_Int16 AP_Scheduler::_loop_rate_hz
private

◆ _loop_timer_start_us

uint32_t AP_Scheduler::_loop_timer_start_us
private

Definition at line 193 of file AP_Scheduler.h.

Referenced by loop().

◆ _num_tasks

uint8_t AP_Scheduler::_num_tasks
private

Definition at line 171 of file AP_Scheduler.h.

Referenced by init(), and run().

◆ _perf_counters

AP_HAL::Util::perf_counter_t* AP_Scheduler::_perf_counters
private

Definition at line 199 of file AP_Scheduler.h.

Referenced by run().

◆ _spare_micros

uint32_t AP_Scheduler::_spare_micros
private

Definition at line 187 of file AP_Scheduler.h.

Referenced by load_average(), and run().

◆ _spare_ticks

uint8_t AP_Scheduler::_spare_ticks
private

Definition at line 190 of file AP_Scheduler.h.

Referenced by load_average(), and run().

◆ _task_time_allowed

uint32_t AP_Scheduler::_task_time_allowed
private

Definition at line 181 of file AP_Scheduler.h.

Referenced by run(), and time_available_usec().

◆ _task_time_started

uint32_t AP_Scheduler::_task_time_started
private

Definition at line 184 of file AP_Scheduler.h.

Referenced by run(), and time_available_usec().

◆ _tasks

const struct Task* AP_Scheduler::_tasks
private

Definition at line 168 of file AP_Scheduler.h.

Referenced by init(), and run().

◆ _tick_counter

uint16_t AP_Scheduler::_tick_counter
private

Definition at line 175 of file AP_Scheduler.h.

Referenced by init(), run(), tick(), and ticks().

◆ current_task

int8_t AP_Scheduler::current_task = -1
static

◆ perf_info

AP::PerfInfo AP_Scheduler::perf_info

◆ var_info

const AP_Param::GroupInfo AP_Scheduler::var_info
static
Initial value:

Definition at line 140 of file AP_Scheduler.h.

Referenced by AP_Scheduler().


The documentation for this class was generated from the following files: