You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2024/10/25 11:04:22 UTC
(nuttx) 12/21: drivers/segger: add heap note support
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch releases/12.7
in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit f61bfd56082524e5a307d197cf871f3d37de3b64
Author: xuxingliang <xu...@xiaomi.com>
AuthorDate: Sat Jul 6 19:38:29 2024 +0800
drivers/segger: add heap note support
Signed-off-by: xuxingliang <xu...@xiaomi.com>
Signed-off-by: Neo Xu <ne...@gmail.com>
---
drivers/segger/note_sysview.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/drivers/segger/note_sysview.c b/drivers/segger/note_sysview.c
index 1b221fff5a..0af3f562dc 100644
--- a/drivers/segger/note_sysview.c
+++ b/drivers/segger/note_sysview.c
@@ -73,6 +73,11 @@ static void note_sysview_syscall_enter(FAR struct note_driver_s *drv,
static void note_sysview_syscall_leave(FAR struct note_driver_s *drv,
int nr, uintptr_t result);
#endif
+#ifdef CONFIG_SCHED_INSTRUMENTATION_HEAP
+static void note_sysview_heap(FAR struct note_driver_s *drv,
+ uint8_t event, FAR void *heap, FAR void *mem,
+ size_t size);
+#endif
/****************************************************************************
* Private Data
@@ -113,6 +118,9 @@ static const struct note_driver_ops_s g_note_sysview_ops =
#ifdef CONFIG_SCHED_INSTRUMENTATION_IRQHANDLER
note_sysview_irqhandler, /* irqhandler */
#endif
+#ifdef CONFIG_SCHED_INSTRUMENTATION_HEAP
+ note_sysview_heap, /* heap */
+#endif
};
static struct note_sysview_driver_s g_note_sysview_driver =
@@ -319,6 +327,28 @@ static void note_sysview_syscall_leave(FAR struct note_driver_s *drv,
}
#endif
+#ifdef CONFIG_SCHED_INSTRUMENTATION_HEAP
+static void note_sysview_heap(FAR struct note_driver_s *drv,
+ uint8_t event, FAR void *heap, FAR void *mem,
+ size_t size)
+{
+ switch (event)
+ {
+ case NOTE_HEAP_ALLOC:
+ SEGGER_SYSVIEW_HeapAlloc(heap, mem, size);
+ break;
+ case NOTE_HEAP_FREE:
+ SEGGER_SYSVIEW_HeapFree(heap, mem);
+ break;
+ case NOTE_HEAP_ADD:
+ SEGGER_SYSVIEW_HeapDefine(heap, mem, size, 0);
+ break;
+ default:
+ break;
+ }
+}
+#endif
+
/****************************************************************************
* Public Functions
****************************************************************************/