Classes | |
| class | pw::thread::threadx::Context |
| class | pw::thread::threadx::ContextWithStack< kStackSizeWords > |
| class | pw::thread::threadx::Options |
Macros | |
| #define | PW_THREAD_THREADX_CONFIG_JOINING_ENABLED 0 |
| #define | PW_THREAD_THREADX_CONFIG_DEFAULT_STACK_SIZE_WORDS (TX_MINIMUM_STACK / sizeof(ULONG)) |
| #define | PW_THREAD_THREADX_CONFIG_MAX_THREAD_NAME_LEN 15 |
| #define | PW_THREAD_THREADX_CONFIG_DEFAULT_TIME_SLICE_INTERVAL TX_NO_TIME_SLICE |
| #define | PW_THREAD_THREADX_CONFIG_MIN_PRIORITY (TX_MAX_PRIORITIES - 1) |
| #define | PW_THREAD_THREADX_CONFIG_DEFAULT_PRIORITY PW_THREAD_THREADX_CONFIG_MIN_PRIORITY |
| #define | PW_THREAD_THREADX_CONFIG_LOG_LEVEL PW_LOG_LEVEL_DEBUG |
| The log level to use for this module. Logs below this level are omitted. | |
Typedefs | |
| using | pw::thread::threadx::ThreadCallback = pw::Function< bool(const TX_THREAD &)> |
Functions | |
| Status | pw::thread::threadx::SnapshotThreads (void *running_thread_stack_pointer, proto::SnapshotThreadInfo::StreamEncoder &encoder, ProcessThreadStackCallback &thread_stack_callback) |
| Status | pw::thread::threadx::SnapshotThread (const TX_THREAD &thread, void *running_thread_stack_pointer, proto::Thread::StreamEncoder &encoder, ProcessThreadStackCallback &thread_stack_callback) |
| Status | pw::thread::threadx::ForEachThread (const ThreadCallback &cb) |
Variables | |
| constexpr size_t | pw::thread::threadx::config::kMaximumNameLength |
| Maximum length of a thread's name, not including null termination. | |
| constexpr size_t | pw::thread::threadx::config::kMinimumStackSizeWords |
Minimum ThreadX stack size in words (ULONG elements). | |
| constexpr size_t | pw::thread::threadx::config::kDefaultStackSizeWords |
Default stack size in words (ULONG elements). | |
| constexpr UINT | pw::thread::threadx::config::kMinimumPriority = (TX_MAX_PRIORITIES - 1) |
| Minimum ThreadX priority level (numerically highest value). | |
| constexpr UINT | pw::thread::threadx::config::kDefaultPriority |
| Default ThreadX priority level. | |
| constexpr ULONG | pw::thread::threadx::config::kDefaultTimeSliceInterval |
| #define PW_THREAD_THREADX_CONFIG_DEFAULT_PRIORITY PW_THREAD_THREADX_CONFIG_MIN_PRIORITY |
The default priority level. By default this uses the minimal ThreadX priority level, given that 0 is the highest priority.
| #define PW_THREAD_THREADX_CONFIG_DEFAULT_STACK_SIZE_WORDS (TX_MINIMUM_STACK / sizeof(ULONG)) |
The default stack size in words (ULONG elements). By default this uses the minimal ThreadX stack size.
| #define PW_THREAD_THREADX_CONFIG_DEFAULT_TIME_SLICE_INTERVAL TX_NO_TIME_SLICE |
The round-robin time slice tick interval for threads at the same priority. By default this is disabled as not all ports support this, using a value of 0 ticks.
| #define PW_THREAD_THREADX_CONFIG_JOINING_ENABLED 0 |
Whether thread joining is enabled. By default this is disabled.
We suggest only enabling this when thread joining is required to minimize the RAM and ROM cost of threads.
Enabling this grows the RAM footprint of every pw::Thread as it adds a TX_EVENT_FLAGS_GROUP to every thread's pw::thread::threadx::Context. In addition, there is a minute ROM cost to construct and destroy this added object.
PW_THREAD_JOINING_ENABLED gets set to this value.
| #define PW_THREAD_THREADX_CONFIG_MAX_THREAD_NAME_LEN 15 |
The maximum length of a thread's name, not including null termination. By default this is arbitrarily set to 15. This results in an array of characters which is this length + 1 bytes in every pw::Thread's context.
| #define PW_THREAD_THREADX_CONFIG_MIN_PRIORITY (TX_MAX_PRIORITIES - 1) |
The minimum priority level (numerically highest value, since 0 is the highest priority in ThreadX). Normally based on the number of priority levels.
| using pw::thread::threadx::ThreadCallback = typedef pw::Function<bool(const TX_THREAD&)> |
A callback that is executed for each thread when using ForEachThread(). The callback should return true if thread iteration should continue. When this callback returns false, ForEachThread() ceases iteration of threads and returns an ABORTED error code.
| Status pw::thread::threadx::ForEachThread | ( | const ThreadCallback & | cb | ) |
Iterates through all threads that haven't been deleted, calling the provided callback on each thread.
| [in] | cb | Callback invoked for each non-deleted thread. |
| Status pw::thread::threadx::SnapshotThread | ( | const TX_THREAD & | thread, |
| void * | running_thread_stack_pointer, | ||
| proto::Thread::StreamEncoder & | encoder, | ||
| ProcessThreadStackCallback & | thread_stack_callback | ||
| ) |
Captures only the provided thread handle as a pw.thread.Thread proto message. After thread info capture, thread_stack_callback is called to capture either the raw_stack or raw_backtrace.
An updated running_thread_stack_pointer must be provided in order for the running thread's context to reflect the current state. If the thread being captured is not the running thread, the value is ignored. Note that the stack pointer in the thread handle is almost always stale on the running thread.
Captures the following pw.thread.Thread proto fields:
nameidstatestack_start_pointerstack_end_pointerstack_pointer| [in] | thread | ThreadX TCB to capture. |
| [in] | running_thread_stack_pointer | Updated stack pointer of the currently running thread (ignored if thread is not the running thread). |
| [in,out] | encoder | Protobuf encoder to write the captured thread into. |
| [in,out] | thread_stack_callback | Callback invoked to capture either the raw_stack or raw_backtrace. |
thread_stack_callback or encoder. | Status pw::thread::threadx::SnapshotThreads | ( | void * | running_thread_stack_pointer, |
| proto::SnapshotThreadInfo::StreamEncoder & | encoder, | ||
| ProcessThreadStackCallback & | thread_stack_callback | ||
| ) |
Captures all ThreadX threads in a system as part of a snapshot.
An updated running_thread_stack_pointer must be provided in order for the running thread's context to reflect the running state. For ARM, you might do something like this:
| [in] | running_thread_stack_pointer | Updated stack pointer of the currently running thread. |
| [in,out] | encoder | Protobuf encoder to write captured threads into. |
| [in,out] | thread_stack_callback | Callback invoked for each thread to capture either its raw_stack or raw_backtrace. |
thread_stack_callback or encoder.
|
inlineconstexpr |
Default ThreadX priority level.
|
inlineconstexpr |
Default stack size in words (ULONG elements).
|
inlineconstexpr |
Default round-robin time slice tick interval for threads at the same priority.
|
inlineconstexpr |
Maximum length of a thread's name, not including null termination.
|
inlineconstexpr |
Minimum ThreadX stack size in words (ULONG elements).