1 /* 2 * Copyright (c) 2021 Intel Corporation 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 #ifndef ZEPHYR_INCLUDE_TRACING_TRACKING_H_ 7 #define ZEPHYR_INCLUDE_TRACING_TRACKING_H_ 8 9 #include <zephyr/kernel.h> 10 #include <zephyr/kernel_structs.h> 11 12 #if defined(CONFIG_TRACING_OBJECT_TRACKING) || defined(__DOXYGEN__) 13 14 /** 15 * @brief Object tracking 16 * 17 * Object tracking provides lists to kernel objects, so their 18 * existence and current status can be tracked. 19 * 20 * The following global variables are the heads of available lists: 21 * - _track_list_k_timer 22 * - _track_list_k_mem_slab 23 * - _track_list_k_sem 24 * - _track_list_k_mutex 25 * - _track_list_k_stack 26 * - _track_list_k_msgq 27 * - _track_list_k_mbox 28 * - _track_list_k_pipe 29 * - _track_list_k_queue 30 * - _track_list_k_event 31 * 32 * @defgroup subsys_tracing_object_tracking Object tracking 33 * @ingroup subsys_tracing 34 * @{ 35 */ 36 37 extern struct k_timer *_track_list_k_timer; 38 extern struct k_mem_slab *_track_list_k_mem_slab; 39 extern struct k_sem *_track_list_k_sem; 40 extern struct k_mutex *_track_list_k_mutex; 41 extern struct k_stack *_track_list_k_stack; 42 extern struct k_msgq *_track_list_k_msgq; 43 extern struct k_mbox *_track_list_k_mbox; 44 extern struct k_pipe *_track_list_k_pipe; 45 extern struct k_queue *_track_list_k_queue; 46 extern struct k_event *_track_list_k_event; 47 48 /** 49 * @brief Gets node's next element in a object tracking list. 50 * 51 * @param list Node to get next element from. 52 */ 53 #define SYS_PORT_TRACK_NEXT(list)((list)->_obj_track_next) 54 55 /** @cond INTERNAL_HIDDEN */ 56 57 #define sys_port_track_k_thread_start(thread) 58 #define sys_port_track_k_thread_create(new_thread) 59 #define sys_port_track_k_thread_sched_ready(thread) 60 #define sys_port_track_k_thread_wakeup(thread) 61 #define sys_port_track_k_thread_sched_priority_set(thread, prio) 62 #define sys_port_track_k_work_delayable_init(dwork) 63 #define sys_port_track_k_work_queue_init(queue) 64 #define sys_port_track_k_work_init(work) 65 #define sys_port_track_k_mutex_init(mutex, ret) \ 66 sys_track_k_mutex_init(mutex) 67 #define sys_port_track_k_timer_stop(timer) 68 #define sys_port_track_k_timer_start(timer, duration, period) 69 #define sys_port_track_k_timer_init(timer) \ 70 sys_track_k_timer_init(timer) 71 #define sys_port_track_k_queue_peek_tail(queue, ret) 72 #define sys_port_track_k_queue_peek_head(queue, ret) 73 #define sys_port_track_k_queue_cancel_wait(queue) 74 #define sys_port_track_k_queue_init(queue) \ 75 sys_track_k_queue_init(queue) 76 #define sys_port_track_k_pipe_init(pipe) \ 77 sys_track_k_pipe_init(pipe) 78 #define sys_port_track_k_condvar_init(condvar, ret) 79 #define sys_port_track_k_stack_init(stack) \ 80 sys_track_k_stack_init(stack) 81 #define sys_port_track_k_thread_name_set(thread, ret) 82 #define sys_port_track_k_sem_reset(sem) 83 #define sys_port_track_k_sem_init(sem, ret) \ 84 sys_track_k_sem_init(sem) 85 #define sys_port_track_k_msgq_purge(msgq) 86 #define sys_port_track_k_msgq_peek(msgq, ret) 87 #define sys_port_track_k_msgq_init(msgq) \ 88 sys_track_k_msgq_init(msgq) 89 #define sys_port_track_k_mbox_init(mbox) \ 90 sys_track_k_mbox_init(mbox) 91 #define sys_port_track_k_mem_slab_init(slab, rc) \ 92 sys_track_k_mem_slab_init(slab) 93 #define sys_port_track_k_heap_free(h) 94 #define sys_port_track_k_heap_init(h) 95 #define sys_port_track_k_event_init(event) \ 96 sys_track_k_event_init(event); 97 98 #define sys_port_track_socket_init(sock, family, type, proto) \ 99 sys_track_socket_init(sock, family, type, proto); 100 101 void sys_track_k_timer_init(struct k_timer *timer); 102 void sys_track_k_mem_slab_init(struct k_mem_slab *slab); 103 void sys_track_k_sem_init(struct k_sem *sem); 104 void sys_track_k_mutex_init(struct k_mutex *mutex); 105 void sys_track_k_stack_init(struct k_stack *stack); 106 void sys_track_k_msgq_init(struct k_msgq *msgq); 107 void sys_track_k_mbox_init(struct k_mbox *mbox); 108 void sys_track_k_pipe_init(struct k_pipe *pipe); 109 void sys_track_k_queue_init(struct k_queue *queue); 110 void sys_track_k_event_init(struct k_event *event); 111 void sys_track_socket_init(int sock, int family, int type, int proto); 112 113 /** @endcond */ 114 115 /** @} */ /* end of subsys_tracing_object_tracking */ 116 117 #else 118 119 #define sys_port_track_k_thread_start(thread) 120 #define sys_port_track_k_thread_create(new_thread) 121 #define sys_port_track_k_thread_sched_ready(thread) 122 #define sys_port_track_k_thread_wakeup(thread) 123 #define sys_port_track_k_thread_sched_priority_set(thread, prio) 124 #define sys_port_track_k_work_delayable_init(dwork) 125 #define sys_port_track_k_work_queue_init(queue) 126 #define sys_port_track_k_work_init(work) 127 #define sys_port_track_k_mutex_init(mutex, ret) 128 #define sys_port_track_k_timer_stop(timer) 129 #define sys_port_track_k_timer_start(timer, duration, period) 130 #define sys_port_track_k_timer_init(timer) 131 #define sys_port_track_k_queue_peek_tail(queue, ret) 132 #define sys_port_track_k_queue_peek_head(queue, ret) 133 #define sys_port_track_k_queue_cancel_wait(queue) 134 #define sys_port_track_k_queue_init(queue) 135 #define sys_port_track_k_pipe_init(pipe) 136 #define sys_port_track_k_condvar_init(condvar, ret) 137 #define sys_port_track_k_stack_init(stack) 138 #define sys_port_track_k_thread_name_set(thread, ret) 139 #define sys_port_track_k_sem_reset(sem) 140 #define sys_port_track_k_sem_init(sem, ret) 141 #define sys_port_track_k_msgq_purge(msgq) 142 #define sys_port_track_k_msgq_peek(msgq, ret) 143 #define sys_port_track_k_msgq_init(msgq) 144 #define sys_port_track_k_mbox_init(mbox) 145 #define sys_port_track_k_mem_slab_init(slab, rc) 146 #define sys_port_track_k_heap_free(h) 147 #define sys_port_track_k_heap_init(h) 148 #define sys_port_track_k_event_init(event) 149 #define sys_port_track_socket_init(sock, family, type, proto) 150 151 #endif 152 153 #endif /* ZEPHYR_INCLUDE_TRACING_TRACKING_H_ */ 154