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
|
@ -23,6 +23,7 @@ extern "C" {
|
|||
#define KERNEL_EVENT_LOGGER_CONTEXT_SWITCH_EVENT_ID 0x0001
|
||||
#define KERNEL_EVENT_LOGGER_INTERRUPT_EVENT_ID 0x0002
|
||||
#define KERNEL_EVENT_LOGGER_SLEEP_EVENT_ID 0x0003
|
||||
#define KERNEL_EVENT_LOGGER_THREAD_EVENT_ID 0x0004
|
||||
|
||||
#ifndef _ASMLANGUAGE
|
||||
|
||||
|
@ -33,14 +34,33 @@ extern int _sys_k_event_logger_mask;
|
|||
extern void _sys_k_event_logger_enter_sleep(void);
|
||||
extern void _sys_k_event_logger_exit_sleep(void);
|
||||
#else
|
||||
static inline void _sys_k_event_logger_enter_sleep(void) {};
|
||||
static inline void _sys_k_event_logger_exit_sleep(void) {};
|
||||
static inline void _sys_k_event_logger_enter_sleep(void) {}
|
||||
static inline void _sys_k_event_logger_exit_sleep(void) {}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_KERNEL_EVENT_LOGGER_INTERRUPT
|
||||
extern void _sys_k_event_logger_interrupt(void);
|
||||
#else
|
||||
static inline void _sys_k_event_logger_interrupt(void) {};
|
||||
static inline void _sys_k_event_logger_interrupt(void) {}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_KERNEL_EVENT_LOGGER_THREAD
|
||||
#include <kernel.h>
|
||||
|
||||
enum sys_k_event_logger_thread_event {
|
||||
KERNEL_LOG_THREAD_EVENT_READYQ,
|
||||
KERNEL_LOG_THREAD_EVENT_PEND,
|
||||
KERNEL_LOG_THREAD_EVENT_EXIT,
|
||||
};
|
||||
|
||||
extern void _sys_k_event_logger_thread_ready(struct k_thread *thread);
|
||||
extern void _sys_k_event_logger_thread_pend(struct k_thread *thread);
|
||||
extern void _sys_k_event_logger_thread_exit(struct k_thread *thread);
|
||||
#else
|
||||
static inline void _sys_k_event_logger_thread_create(void *thread) {}
|
||||
static inline void _sys_k_event_logger_thread_ready(void *thread) {}
|
||||
static inline void _sys_k_event_logger_thread_pend(void *thread) {}
|
||||
static inline void _sys_k_event_logger_thread_exit(void *thread) {}
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue