|
Motorcortex Core
version: 2.7.6
|
Event loop and concurrency primitive for Motorcortex modules. More...
#include <ct_task.h>
Public Member Functions | |
| Task (const char *name, parameter_server::Parameter *parent) | |
| Creates new task. More... | |
| virtual | ~Task () |
| Destructor brings all the task modules to a destroy phase. | |
| Task ()=delete | |
| Default constructor is deleted. | |
| Task (Task &orig)=delete | |
| Copy constructors are deleted. | |
| Task & | operator= (Task &orig)=delete |
| Copy constructors are deleted. | |
| void | setName (const char *name) |
| Sets the name of the task. More... | |
| const char * | getName () const |
| Returns the name of the task. More... | |
| bool | running () const |
| Returns true if task is running. | |
| void | setStackSize (uint64_t size_bytes) |
| Sets stack size of the task bytes. More... | |
| uint64_t | getStackSize () const |
| Returns stack size of the task im bytes. More... | |
| void | add (Module *module) |
| Adds module to the task. More... | |
| void | add (const std::vector< Module * > &modules) |
| Adds list of modules to the task. More... | |
| void | configure () |
| Starts Configuration Phase of the task. More... | |
| void | start (uint64_t cycle_time_micro_s, TaskSched task_sched, const std::vector< uint32_t > &cpu_affinity_list={}, uint32_t priority=0) |
| Starts Operation Phase of the task. More... | |
| void | start (cmd_line::Task) |
| void | stop () |
| Stops Operation Phase of the task. More... | |
| void | setCycleTimeMicroS (uint64_t cycle_time_micro_s) |
| Sets a cycle time of the event-loop of the task. More... | |
| uint64_t | getCycleMicroS () const |
| Gets cycle time of the event-loop of the task in microseconds. More... | |
| double | getCycleTimeS () const |
| Gets cycle time of the event-loop of the task in seconds. More... | |
| uint64_t | getNrOfCycles () const |
| Gets number of execution cycles. More... | |
| bool | setSchedPolicy (uint32_t policy) |
| Sets task scheduler policy. More... | |
| uint32_t | getSchedPolicy () const |
| Gets task scheduler policy. More... | |
| bool | setSchedPriority (int priority) |
| Sets task scheduler priority. More... | |
| int | getSchedPriority () const |
| Gets task scheduler priority. More... | |
| bool | setCpuAffinity (const std::vector< uint32_t > &cpu_affinity_list) |
| Binds task to the list of CPUs. More... | |
| const std::vector< uint32_t > & | getCpuAffinity () const |
| Gets list of CPUs to which task is bound. More... | |
Event loop and concurrency primitive for Motorcortex modules.
| mcx::container::Task::Task | ( | const char * | name, |
| parameter_server::Parameter * | parent | ||
| ) |
Creates new task.
| name | - unique name. |
| parameter_server | - pointer to the root. |
| void mcx::container::Task::add | ( | const std::vector< Module * > & | modules | ) |
Adds list of modules to the task.
| modules | - list of pointers to the modules. |
| void mcx::container::Task::add | ( | Module * | module | ) |
Adds module to the task.
| module | - pointer to the module. |
| void mcx::container::Task::configure | ( | ) |
Starts Configuration Phase of the task.
| const std::vector< uint32_t > & mcx::container::Task::getCpuAffinity | ( | ) | const |
Gets list of CPUs to which task is bound.
| uint64_t mcx::container::Task::getCycleMicroS | ( | ) | const |
Gets cycle time of the event-loop of the task in microseconds.
| double mcx::container::Task::getCycleTimeS | ( | ) | const |
Gets cycle time of the event-loop of the task in seconds.
| const char * mcx::container::Task::getName | ( | ) | const |
Returns the name of the task.
| uint64_t mcx::container::Task::getNrOfCycles | ( | ) | const |
Gets number of execution cycles.
| uint32_t mcx::container::Task::getSchedPolicy | ( | ) | const |
Gets task scheduler policy.
| int mcx::container::Task::getSchedPriority | ( | ) | const |
Gets task scheduler priority.
| uint64_t mcx::container::Task::getStackSize | ( | ) | const |
Returns stack size of the task im bytes.
| bool mcx::container::Task::setCpuAffinity | ( | const std::vector< uint32_t > & | cpu_affinity_list | ) |
Binds task to the list of CPUs.
| cpu_affinity_list | - list of CPUs, to which the task is bound to. |
| void mcx::container::Task::setCycleTimeMicroS | ( | uint64_t | cycle_time_micro_s | ) |
Sets a cycle time of the event-loop of the task.
| cycle_time_micro_s | - new cycle time in microseconds. |
| void mcx::container::Task::setName | ( | const char * | name | ) |
Sets the name of the task.
| name | - name of the task. |
| bool mcx::container::Task::setSchedPolicy | ( | uint32_t | policy | ) |
Sets task scheduler policy.
| policy | - new scheduler policy: SCHED_OTHER, SCHED_FIFO etc.: |
| bool mcx::container::Task::setSchedPriority | ( | int | priority | ) |
Sets task scheduler priority.
Tasks scheduled with SCHED_OTHER (NORMAL) have static priority 0. Processes scheduled under SCHED_FIFO or SCHED_RR (REALTIME) can have a static priority in the range 1 to 99.
| void mcx::container::Task::setStackSize | ( | uint64_t | size_bytes | ) |
Sets stack size of the task bytes.
| size_bytes | - new size of the stack. |
| void mcx::container::Task::start | ( | uint64_t | cycle_time_micro_s, |
| TaskSched | task_sched, | ||
| const std::vector< uint32_t > & | cpu_affinity_list = {}, |
||
| uint32_t | priority = 0 |
||
| ) |
Starts Operation Phase of the task.
| cycle_time_micro_s | - a cycle time of the event loop of the task. |
| task_sched | - scheduler policy of the task: REALTIME for the tasks, which require realtime and NORMAL for everything else. |
| cpu_affinity_list | - binding task to the list of CPUs. |
| priority | - tasks scheduled with NORMAL priority have static priority 0, processes scheduled under REALTIME can have a static priority in the range 1 to 99. |
| void mcx::container::Task::stop | ( | ) |
Stops Operation Phase of the task.