Tracing: Semaphore tracing documentation
Add default semaphore trace hooks and documentation into tracing.h. Signed-off-by: Torbjörn Leksell <torbjorn.leksell@percepio.com> Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
parent
fcf2fb6320
commit
82addd6a64
2 changed files with 72 additions and 27 deletions
|
@ -19,7 +19,7 @@
|
|||
#define SYS_TRACE_ID_SEMA_TAKE (6u + SYS_TRACE_ID_OFFSET)
|
||||
#define SYS_TRACE_ID_SLEEP (7u + SYS_TRACE_ID_OFFSET)
|
||||
|
||||
#ifdef CONFIG_SEGGER_SYSTEMVIEW
|
||||
#if defined CONFIG_SEGGER_SYSTEMVIEW
|
||||
#include "tracing_sysview.h"
|
||||
|
||||
#elif defined CONFIG_TRACING_CTF
|
||||
|
@ -132,24 +132,6 @@
|
|||
*/
|
||||
#define sys_trace_idle()
|
||||
|
||||
/**
|
||||
* @brief Trace initialisation of a Semaphore
|
||||
* @param sem Semaphore object
|
||||
*/
|
||||
#define sys_trace_semaphore_init(sem)
|
||||
|
||||
/**
|
||||
* @brief Trace taking a Semaphore
|
||||
* @param sem Semaphore object
|
||||
*/
|
||||
#define sys_trace_semaphore_take(sem)
|
||||
|
||||
/**
|
||||
* @brief Trace giving a Semaphore
|
||||
* @param sem Semaphore object
|
||||
*/
|
||||
#define sys_trace_semaphore_give(sem)
|
||||
|
||||
/**
|
||||
* @brief Trace initialisation of a Mutex
|
||||
* @param mutex Mutex object
|
||||
|
@ -171,5 +153,76 @@
|
|||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @brief Tracing APIs
|
||||
* @defgroup tracing_apis Tracing APIs
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @brief Semaphore Tracing APIs
|
||||
* @defgroup sem_tracing_apis Semaphore Tracing APIs
|
||||
* @ingroup tracing_apis
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Trace initialisation of a Semaphore
|
||||
* @param sem Semaphore object
|
||||
* @param ret Return value
|
||||
*/
|
||||
#define sys_port_trace_k_sem_init(sem, ret)
|
||||
|
||||
/**
|
||||
* @brief Trace giving a Semaphore entry
|
||||
* @param sem Semaphore object
|
||||
*/
|
||||
#define sys_port_trace_k_sem_give_enter(sem)
|
||||
|
||||
/**
|
||||
* @brief Trace giving a Semaphore exit
|
||||
* @param sem Semaphore object
|
||||
*/
|
||||
#define sys_port_trace_k_sem_give_exit(sem)
|
||||
|
||||
/**
|
||||
* @brief Trace taking a Semaphore attempt start
|
||||
* @param sem Semaphore object
|
||||
* @param timeout Timeout period
|
||||
*/
|
||||
#define sys_port_trace_k_sem_take_enter(sem, timeout)
|
||||
|
||||
/**
|
||||
* @brief Trace taking a Semaphore attempt blocking
|
||||
* @param sem Semaphore object
|
||||
* @param timeout Timeout period
|
||||
*/
|
||||
#define sys_port_trace_k_sem_take_blocking(sem, timeout)
|
||||
|
||||
/**
|
||||
* @brief Trace taking a Semaphore attempt outcome
|
||||
* @param sem Semaphore object
|
||||
* @param timeout Timeout period
|
||||
* @param ret Return value
|
||||
*/
|
||||
#define sys_port_trace_k_sem_take_exit(sem, timeout, ret)
|
||||
|
||||
/**
|
||||
* @brief Trace resetting a Semaphore
|
||||
* @param sem Semaphore object
|
||||
*/
|
||||
#define sys_port_trace_k_sem_reset(sem)
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/ /* end of sem_tracing_apis */
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -76,7 +76,6 @@ int z_impl_k_sem_init(struct k_sem *sem, unsigned int initial_count,
|
|||
|
||||
SYS_PORT_TRACING_OBJ_FUNC(k_sem, init, sem, 0);
|
||||
|
||||
sys_trace_semaphore_init(sem);
|
||||
z_waitq_init(&sem->wait_q);
|
||||
#if defined(CONFIG_POLL)
|
||||
sys_dlist_init(&sem->poll_events);
|
||||
|
@ -84,7 +83,6 @@ int z_impl_k_sem_init(struct k_sem *sem, unsigned int initial_count,
|
|||
SYS_TRACING_OBJ_INIT(k_sem, sem);
|
||||
|
||||
z_object_init(sem);
|
||||
sys_trace_end_call(SYS_TRACE_ID_SEMA_INIT);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -115,7 +113,6 @@ void z_impl_k_sem_give(struct k_sem *sem)
|
|||
|
||||
SYS_PORT_TRACING_OBJ_FUNC_ENTER(k_sem, give, sem);
|
||||
|
||||
sys_trace_semaphore_give(sem);
|
||||
thread = z_unpend_first_thread(&sem->wait_q);
|
||||
|
||||
if (thread != NULL) {
|
||||
|
@ -129,8 +126,6 @@ void z_impl_k_sem_give(struct k_sem *sem)
|
|||
z_reschedule(&lock, key);
|
||||
|
||||
SYS_PORT_TRACING_OBJ_FUNC_EXIT(k_sem, give, sem);
|
||||
|
||||
sys_trace_end_call(SYS_TRACE_ID_SEMA_GIVE);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_USERSPACE
|
||||
|
@ -153,8 +148,6 @@ int z_impl_k_sem_take(struct k_sem *sem, k_timeout_t timeout)
|
|||
|
||||
SYS_PORT_TRACING_OBJ_FUNC_ENTER(k_sem, take, sem, timeout);
|
||||
|
||||
sys_trace_semaphore_take(sem);
|
||||
|
||||
if (likely(sem->count > 0U)) {
|
||||
sem->count--;
|
||||
k_spin_unlock(&lock, key);
|
||||
|
@ -175,7 +168,6 @@ int z_impl_k_sem_take(struct k_sem *sem, k_timeout_t timeout)
|
|||
out:
|
||||
SYS_PORT_TRACING_OBJ_FUNC_EXIT(k_sem, take, sem, timeout, ret);
|
||||
|
||||
sys_trace_end_call(SYS_TRACE_ID_SEMA_TAKE);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue