Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
uavcan::Scheduler Class Reference

#include <scheduler.hpp>

Inheritance diagram for uavcan::Scheduler:
Inheritance graph
[legend]

Classes

struct  InsideSpinSetter
 

Public Member Functions

MonotonicDuration getCleanupPeriod () const
 
MonotonicDuration getDeadlineResolution () const
 
DeadlineSchedulergetDeadlineScheduler ()
 
DispatchergetDispatcher ()
 
const DispatchergetDispatcher () const
 
MonotonicTime getMonotonicTime () const
 
ISystemClockgetSystemClock ()
 
UtcTime getUtcTime () const
 
 Scheduler (ICanDriver &can_driver, IPoolAllocator &allocator, ISystemClock &sysclock)
 
void setCleanupPeriod (MonotonicDuration period)
 
void setDeadlineResolution (MonotonicDuration res)
 
int spin (MonotonicTime deadline)
 
int spinOnce ()
 

Private Types

enum  { DefaultDeadlineResolutionMs = 5 }
 
enum  { MinDeadlineResolutionMs = 1 }
 
enum  { MaxDeadlineResolutionMs = 100 }
 
enum  { DefaultCleanupPeriodMs = 1000 }
 
enum  { MinCleanupPeriodMs = 10 }
 
enum  { MaxCleanupPeriodMs = 10000 }
 

Private Member Functions

MonotonicTime computeDispatcherSpinDeadline (MonotonicTime spin_deadline) const
 
void pollCleanup (MonotonicTime mono_ts, uint32_t num_frames_processed_with_last_spin)
 
- Private Member Functions inherited from uavcan::Noncopyable
 Noncopyable ()
 
 ~Noncopyable ()
 

Private Attributes

MonotonicDuration cleanup_period_
 
MonotonicDuration deadline_resolution_
 
DeadlineScheduler deadline_scheduler_
 
Dispatcher dispatcher_
 
bool inside_spin_
 
MonotonicTime prev_cleanup_ts_
 

Detailed Description

This class distributes processing time between library components (IO handling, deadline callbacks, ...).

Definition at line 63 of file scheduler.hpp.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
DefaultDeadlineResolutionMs 

Definition at line 65 of file scheduler.hpp.

◆ anonymous enum

anonymous enum
private
Enumerator
MinDeadlineResolutionMs 

Definition at line 66 of file scheduler.hpp.

◆ anonymous enum

anonymous enum
private
Enumerator
MaxDeadlineResolutionMs 

Definition at line 67 of file scheduler.hpp.

◆ anonymous enum

anonymous enum
private
Enumerator
DefaultCleanupPeriodMs 

Definition at line 69 of file scheduler.hpp.

◆ anonymous enum

anonymous enum
private
Enumerator
MinCleanupPeriodMs 

Definition at line 70 of file scheduler.hpp.

◆ anonymous enum

anonymous enum
private
Enumerator
MaxCleanupPeriodMs 

Definition at line 71 of file scheduler.hpp.

Constructor & Destructor Documentation

◆ Scheduler()

uavcan::Scheduler::Scheduler ( ICanDriver can_driver,
IPoolAllocator allocator,
ISystemClock sysclock 
)
inline

Definition at line 95 of file scheduler.hpp.

Member Function Documentation

◆ computeDispatcherSpinDeadline()

MonotonicTime uavcan::Scheduler::computeDispatcherSpinDeadline ( MonotonicTime  spin_deadline) const
private

Definition at line 129 of file uc_scheduler.cpp.

◆ getCleanupPeriod()

MonotonicDuration uavcan::Scheduler::getCleanupPeriod ( ) const
inline

How often the scheduler will run cleanup (listeners, outgoing transfer registry, ...). Cleanup execution time grows linearly with number of listeners and number of items in the Outgoing Transfer ID registry. Lower period increases CPU usage.

Definition at line 144 of file scheduler.hpp.

◆ getDeadlineResolution()

MonotonicDuration uavcan::Scheduler::getDeadlineResolution ( ) const
inline

Worst case deadline callback resolution. Higher resolution increases CPU usage.

Definition at line 130 of file scheduler.hpp.

◆ getDeadlineScheduler()

DeadlineScheduler& uavcan::Scheduler::getDeadlineScheduler ( )
inline

Definition at line 117 of file scheduler.hpp.

◆ getDispatcher() [1/2]

Dispatcher& uavcan::Scheduler::getDispatcher ( )
inline

Definition at line 119 of file scheduler.hpp.

◆ getDispatcher() [2/2]

const Dispatcher& uavcan::Scheduler::getDispatcher ( ) const
inline

Definition at line 120 of file scheduler.hpp.

◆ getMonotonicTime()

MonotonicTime uavcan::Scheduler::getMonotonicTime ( ) const
inline

Definition at line 123 of file scheduler.hpp.

◆ getSystemClock()

ISystemClock& uavcan::Scheduler::getSystemClock ( )
inline

Definition at line 122 of file scheduler.hpp.

◆ getUtcTime()

UtcTime uavcan::Scheduler::getUtcTime ( ) const
inline

Definition at line 124 of file scheduler.hpp.

◆ pollCleanup()

void uavcan::Scheduler::pollCleanup ( MonotonicTime  mono_ts,
uint32_t  num_frames_processed_with_last_spin 
)
private

Definition at line 143 of file uc_scheduler.cpp.

◆ setCleanupPeriod()

void uavcan::Scheduler::setCleanupPeriod ( MonotonicDuration  period)
inline

Definition at line 145 of file scheduler.hpp.

◆ setDeadlineResolution()

void uavcan::Scheduler::setDeadlineResolution ( MonotonicDuration  res)
inline

Definition at line 131 of file scheduler.hpp.

◆ spin()

int uavcan::Scheduler::spin ( MonotonicTime  deadline)

Spin until the deadline, or until some error occurs. This function will return strictly when the deadline is reached, even if there are unprocessed frames. Returns negative error code.

Definition at line 155 of file uc_scheduler.cpp.

◆ spinOnce()

int uavcan::Scheduler::spinOnce ( )

Non-blocking version of spin() - spins until all pending frames and events are processed, or until some error occurs. If there's nothing to do, returns immediately. Returns negative error code.

Definition at line 186 of file uc_scheduler.cpp.

Member Data Documentation

◆ cleanup_period_

MonotonicDuration uavcan::Scheduler::cleanup_period_
private

Definition at line 77 of file scheduler.hpp.

◆ deadline_resolution_

MonotonicDuration uavcan::Scheduler::deadline_resolution_
private

Definition at line 76 of file scheduler.hpp.

◆ deadline_scheduler_

DeadlineScheduler uavcan::Scheduler::deadline_scheduler_
private

Definition at line 73 of file scheduler.hpp.

◆ dispatcher_

Dispatcher uavcan::Scheduler::dispatcher_
private

Definition at line 74 of file scheduler.hpp.

◆ inside_spin_

bool uavcan::Scheduler::inside_spin_
private

Definition at line 78 of file scheduler.hpp.

◆ prev_cleanup_ts_

MonotonicTime uavcan::Scheduler::prev_cleanup_ts_
private

Definition at line 75 of file scheduler.hpp.


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


uavcan_communicator
Author(s):
autogenerated on Fri Dec 13 2024 03:10:05