kernel: Add thread events to kernel event logger
This adds a new event type to the kernel event logger that tracks thread-related events: being added to the ready queue, pending a thread, and exiting a thread. It's the only event type that contains "subevents" and thus has a non-void parameter in their respective _sys_k_event_logger_*() function. Luckily, as isn't the case with other events (such as IRQs and thread switching), these functions are called from platform-agnostic places, so there's no need to worry about changing the assembly guts. This is the first patch in a series adding support for better real-time profiling of Zephyr applications. Jira: ZEP-1463 Change-Id: I6d63607ba347f7a9cac3d016fef8f5a0a830e267 Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
This commit is contained in:
parent
35a48decfa
commit
ffe74b45fa
4 changed files with 89 additions and 3 deletions
|
@ -9,6 +9,10 @@
|
|||
|
||||
#include <kernel_structs.h>
|
||||
|
||||
#ifdef CONFIG_KERNEL_EVENT_LOGGER
|
||||
#include <logging/kernel_event_logger.h>
|
||||
#endif /* CONFIG_KERNEL_EVENT_LOGGER */
|
||||
|
||||
extern k_tid_t const _main_thread;
|
||||
extern k_tid_t const _idle_thread;
|
||||
|
||||
|
@ -336,6 +340,10 @@ static inline int _is_thread_ready(struct k_thread *thread)
|
|||
static inline void _mark_thread_as_pending(struct k_thread *thread)
|
||||
{
|
||||
thread->base.thread_state |= _THREAD_PENDING;
|
||||
|
||||
#ifdef CONFIG_KERNEL_EVENT_LOGGER_THREAD
|
||||
_sys_k_event_logger_thread_pend(thread);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* mark a thread as not pending in its TCS */
|
||||
|
@ -406,6 +414,10 @@ static inline void _ready_thread(struct k_thread *thread)
|
|||
if (_is_thread_ready(thread)) {
|
||||
_add_thread_to_ready_q(thread);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_KERNEL_EVENT_LOGGER_THREAD
|
||||
_sys_k_event_logger_thread_ready(thread);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -416,6 +428,10 @@ static inline void _ready_thread(struct k_thread *thread)
|
|||
static inline void _mark_thread_as_dead(struct k_thread *thread)
|
||||
{
|
||||
thread->base.thread_state |= _THREAD_DEAD;
|
||||
|
||||
#ifdef CONFIG_KERNEL_EVENT_LOGGER_THREAD
|
||||
_sys_k_event_logger_thread_exit(thread);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue