tracing: Add calloc

Add the calloc tracing functions.

Signed-off-by: Simone Orru <simone.orru@secomind.com>
This commit is contained in:
Simone Orru 2024-12-18 11:38:05 +01:00 committed by Benjamin Cabé
parent 37fd711a45
commit f53aa42b8b
8 changed files with 49 additions and 3 deletions

View file

@ -1706,6 +1706,21 @@
*/
#define sys_port_trace_k_heap_alloc_exit(h, timeout, ret)
/**
* @brief Trace Heap calloc enter
* @param h Heap object
* @param timeout Timeout period
*/
#define sys_port_trace_k_heap_calloc_enter(h, timeout)
/**
* @brief Trace Heap calloc exit
* @param h Heap object
* @param timeout Timeout period
* @param ret Return value
*/
#define sys_port_trace_k_heap_calloc_exit(h, timeout, ret)
/**
* @brief Trace Heap free
* @param h Heap object

View file

@ -304,6 +304,8 @@ extern "C" {
#define sys_port_trace_k_heap_aligned_alloc_exit(heap, timeout, ret)
#define sys_port_trace_k_heap_alloc_enter(heap, timeout)
#define sys_port_trace_k_heap_alloc_exit(heap, timeout, ret)
#define sys_port_trace_k_heap_calloc_enter(heap, timeout)
#define sys_port_trace_k_heap_calloc_exit(heap, timeout, ret)
#define sys_port_trace_k_heap_free(heap)
#define sys_port_trace_k_heap_realloc_enter(h, ptr, bytes, timeout)
#define sys_port_trace_k_heap_realloc_exit(h, ptr, bytes, timeout, ret)

View file

@ -82,6 +82,7 @@ TaskState 0xBF 1=dummy, 2=Waiting, 4=New, 8=Terminated, 16=Suspended, 32=Termina
76 k_heap_init heap=%I, mem=%p, bytes=%u
77 k_heap_alloc heap=%I, bytes=%u, Timeout=%TimeOut | Returns %p
77 k_heap_calloc heap=%I, num=%u, size=%u, Timeout=%TimeOut | Returns %p
78 k_heap_free heap=%I, mem=%p
79 k_heap_aligned_alloc heap=%I

View file

@ -574,6 +574,13 @@ void sys_trace_thread_info(struct k_thread *thread);
#define sys_port_trace_k_heap_alloc_exit(heap, timeout, ret) \
SEGGER_SYSVIEW_RecordEndCallU32(TID_HEAP_ALLOC, (uint32_t)ret)
#define sys_port_trace_k_heap_calloc_enter(heap, timeout) \
SEGGER_SYSVIEW_RecordU32x2(TID_HEAP_CALLOC, (uint32_t)(uintptr_t)heap, \
(uint32_t)timeout.ticks)
#define sys_port_trace_k_heap_calloc_exit(heap, timeout, ret) \
SEGGER_SYSVIEW_RecordEndCallU32(TID_HEAP_CALLOC, (uint32_t)ret)
#define sys_port_trace_k_heap_free(heap) \
SEGGER_SYSVIEW_RecordU32(TID_HEAP_FREE, (uint32_t)(uintptr_t)heap)

View file

@ -69,9 +69,10 @@ extern "C" {
#define TID_HEAP_INIT (44u + TID_OFFSET)
#define TID_HEAP_ALLOC (45u + TID_OFFSET)
#define TID_HEAP_FREE (46u + TID_OFFSET)
#define TID_HEAP_ALIGNED_ALLOC (47u + TID_OFFSET)
#define TID_HEAP_REALLOC (48u + TID_OFFSET)
#define TID_HEAP_CALLOC (46u + TID_OFFSET)
#define TID_HEAP_FREE (47u + TID_OFFSET)
#define TID_HEAP_ALIGNED_ALLOC (48u + TID_OFFSET)
#define TID_HEAP_REALLOC (49u + TID_OFFSET)
#define TID_MSLAB_INIT (52u + TID_OFFSET)
#define TID_MSLAB_ALLOC (53u + TID_OFFSET)

View file

@ -356,6 +356,11 @@ void sys_trace_k_heap_alloc_enter(struct k_heap *h, size_t bytes, k_timeout_t ti
TRACING_STRING("%s: %p\n", __func__, h);
}
void sys_trace_k_heap_calloc_enter(struct k_heap *h, size_t num, size_t size, k_timeout_t timeout)
{
TRACING_STRING("%s: %p\n", __func__, h);
}
void sys_trace_k_heap_free(struct k_heap *h, void *mem)
{
TRACING_STRING("%s: %p\n", __func__, h);
@ -381,6 +386,12 @@ void sys_trace_k_heap_alloc_exit(struct k_heap *h, size_t bytes, k_timeout_t tim
TRACING_STRING("%s: %p\n", __func__, h);
}
void sys_trace_k_heap_calloc_exit(struct k_heap *h, size_t num, size_t size, k_timeout_t timeout,
void *ret)
{
TRACING_STRING("%s: %p\n", __func__, h);
}
void sys_trace_k_heap_aligned_alloc_exit(struct k_heap *h, size_t bytes,
k_timeout_t timeout, void *ret)
{

View file

@ -381,6 +381,10 @@
sys_trace_k_heap_alloc_enter(h, bytes, timeout)
#define sys_port_trace_k_heap_alloc_exit(h, timeout, ret) \
sys_trace_k_heap_alloc_exit(h, bytes, timeout, ret)
#define sys_port_trace_k_heap_calloc_enter(h, timeout) \
sys_trace_k_heap_calloc_enter(h, num, size, timeout)
#define sys_port_trace_k_heap_calloc_exit(h, timeout, ret) \
sys_trace_k_heap_calloc_exit(h, num, size, timeout, ret)
#define sys_port_trace_k_heap_free(h) sys_trace_k_heap_free(h, mem)
#define sys_port_trace_k_heap_realloc_enter(h, ptr, bytes, timeout) \
sys_trace_k_heap_realloc_enter(h, ptr, bytes, timeout)
@ -660,6 +664,9 @@ void sys_trace_k_msgq_purge(struct k_msgq *msgq);
void sys_trace_k_heap_init(struct k_heap *h, void *mem, size_t bytes);
void sys_trace_k_heap_alloc_enter(struct k_heap *h, size_t bytes, k_timeout_t timeout);
void sys_trace_k_heap_alloc_exit(struct k_heap *h, size_t bytes, k_timeout_t timeout, void *ret);
void sys_trace_k_heap_calloc_enter(struct k_heap *h, size_t num, size_t size, k_timeout_t timeout);
void sys_trace_k_heap_calloc_exit(struct k_heap *h, size_t num, size_t size, k_timeout_t timeout,
void *ret);
void sys_trace_k_heap_aligned_alloc_enter(struct k_heap *h, size_t bytes, k_timeout_t timeout);
void sys_trace_k_heap_aligned_alloc_blocking(struct k_heap *h, size_t bytes, k_timeout_t timeout);
void sys_trace_k_heap_aligned_alloc_exit(struct k_heap *h, size_t bytes, k_timeout_t timeout,

View file

@ -344,6 +344,8 @@ void sys_trace_gpio_fire_callback_user(const struct device *port, struct gpio_ca
#define sys_port_trace_k_heap_aligned_alloc_exit(heap, timeout, ret)
#define sys_port_trace_k_heap_alloc_enter(heap, timeout)
#define sys_port_trace_k_heap_alloc_exit(heap, timeout, ret)
#define sys_port_trace_k_heap_calloc_enter(heap, timeout)
#define sys_port_trace_k_heap_calloc_exit(heap, timeout, ret)
#define sys_port_trace_k_heap_free(heap)
#define sys_port_trace_k_heap_realloc_enter(h, ptr, bytes, timeout)
#define sys_port_trace_k_heap_realloc_exit(h, ptr, bytes, timeout, ret)