Tracing: LIFO Tracing

Add LIFO tracing hooks, default hooks, and documentation.

Signed-off-by: Torbjörn Leksell <torbjorn.leksell@percepio.com>
This commit is contained in:
Torbjörn Leksell 2021-03-26 12:21:24 +01:00 committed by Anas Nashif
commit d765445b3b
2 changed files with 92 additions and 4 deletions

View file

@ -2300,7 +2300,11 @@ struct k_lifo {
* @return N/A
*/
#define k_lifo_init(lifo) \
k_queue_init(&(lifo)->_queue)
({ \
SYS_PORT_TRACING_OBJ_FUNC_ENTER(k_lifo, init, lifo); \
k_queue_init(&(lifo)->_queue); \
SYS_PORT_TRACING_OBJ_FUNC_EXIT(k_lifo, init, lifo); \
})
/**
* @brief Add an element to a LIFO queue.
@ -2317,7 +2321,11 @@ struct k_lifo {
* @return N/A
*/
#define k_lifo_put(lifo, data) \
k_queue_prepend(&(lifo)->_queue, data)
({ \
SYS_PORT_TRACING_OBJ_FUNC_ENTER(k_lifo, put, lifo, data); \
k_queue_prepend(&(lifo)->_queue, data); \
SYS_PORT_TRACING_OBJ_FUNC_EXIT(k_lifo, put, lifo, data); \
})
/**
* @brief Add an element to a LIFO queue.
@ -2336,7 +2344,12 @@ struct k_lifo {
* @retval -ENOMEM if there isn't sufficient RAM in the caller's resource pool
*/
#define k_lifo_alloc_put(lifo, data) \
k_queue_alloc_prepend(&(lifo)->_queue, data)
({ \
SYS_PORT_TRACING_OBJ_FUNC_ENTER(k_lifo, alloc_put, lifo, data); \
int ret = k_queue_alloc_prepend(&(lifo)->_queue, data); \
SYS_PORT_TRACING_OBJ_FUNC_EXIT(k_lifo, alloc_put, lifo, data, ret); \
ret; \
})
/**
* @brief Get an element from a LIFO queue.
@ -2356,7 +2369,12 @@ struct k_lifo {
* without waiting, or waiting period timed out.
*/
#define k_lifo_get(lifo, timeout) \
k_queue_get(&(lifo)->_queue, timeout)
({ \
SYS_PORT_TRACING_OBJ_FUNC_ENTER(k_lifo, get, lifo, timeout); \
void *ret = k_queue_get(&(lifo)->_queue, timeout); \
SYS_PORT_TRACING_OBJ_FUNC_EXIT(k_lifo, get, lifo, timeout, ret); \
ret; \
})
/**
* @brief Statically define and initialize a LIFO queue.

View file

@ -839,6 +839,76 @@
*/ /* end of fifo_tracing_apis */
/**
* @brief LIFO Tracing APIs
* @defgroup lifo_tracing_apis LIFO Tracing APIs
* @ingroup tracing_apis
* @{
*/
/**
* @brief Trace initialization of LIFO Queue entry
* @param lifo LIFO object
*/
#define sys_port_trace_k_lifo_init_enter(lifo)
/**
* @brief Trace initialization of LIFO Queue exit
* @param lifo LIFO object
*/
#define sys_port_trace_k_lifo_init_exit(lifo)
/**
* @brief Trace LIFO Queue put entry
* @param lifo LIFO object
* @param data Data item
*/
#define sys_port_trace_k_lifo_put_enter(lifo, data)
/**
* @brief Trace LIFO Queue put exit
* @param lifo LIFO object
* @param data Data item
*/
#define sys_port_trace_k_lifo_put_exit(lifo, data)
/**
* @brief Trace LIFO Queue alloc put entry
* @param lifo LIFO object
* @param data Data item
*/
#define sys_port_trace_k_lifo_alloc_put_enter(lifo, data)
/**
* @brief Trace LIFO Queue alloc put exit
* @param lifo LIFO object
* @param data Data item
* @param ret Return value
*/
#define sys_port_trace_k_lifo_alloc_put_exit(lifo, data, ret)
/**
* @brief Trace LIFO Queue get entry
* @param lifo LIFO object
* @param timeout Timeout period
*/
#define sys_port_trace_k_lifo_get_enter(lifo, timeout)
/**
* @brief Trace LIFO Queue get exit
* @param lifo LIFO object
* @param timeout Timeout period
* @param ret Return value
*/
#define sys_port_trace_k_lifo_get_exit(lifo, timeout, ret)
/**
* @}
*/ /* end of lifo_tracing_apis */
/**
* @}
*/