mirror of
https://github.com/apache/nuttx.git
synced 2025-12-17 10:16:49 +08:00
sched/note: specify note event for heap instrumentation
1. Add NOTE_HEAP_ prefix for heap note event. 2. Use note type as heap instrumentation parameter. Signed-off-by: xuxingliang <xuxingliang@xiaomi.com> Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
This commit is contained in:
@@ -510,8 +510,8 @@ static void mm_delayfree(FAR struct mm_heap_s *heap, FAR void *mem,
|
||||
{
|
||||
/* Update heap statistics */
|
||||
|
||||
heap->mm_curused -= mm_malloc_size(heap, mem);
|
||||
sched_note_heap(false, heap, mem, size);
|
||||
heap->mm_curused -= size;
|
||||
sched_note_heap(NOTE_HEAP_FREE, heap, mem, size);
|
||||
tlsf_free(heap->mm_tlsf, mem);
|
||||
}
|
||||
|
||||
@@ -1189,7 +1189,7 @@ FAR void *mm_malloc(FAR struct mm_heap_s *heap, size_t size)
|
||||
#endif
|
||||
|
||||
ret = kasan_unpoison(ret, nodesize);
|
||||
sched_note_heap(true, heap, ret, nodesize);
|
||||
sched_note_heap(NOTE_HEAP_ALLOC, heap, ret, nodesize);
|
||||
|
||||
#ifdef CONFIG_MM_FILL_ALLOCATIONS
|
||||
memset(ret, 0xaa, nodesize);
|
||||
@@ -1269,7 +1269,7 @@ FAR void *mm_memalign(FAR struct mm_heap_s *heap, size_t alignment,
|
||||
memdump_backtrace(heap, buf);
|
||||
#endif
|
||||
ret = kasan_unpoison(ret, nodesize);
|
||||
sched_note_heap(true, heap, ret, nodesize);
|
||||
sched_note_heap(NOTE_HEAP_ALLOC, heap, ret, nodesize);
|
||||
}
|
||||
|
||||
#if CONFIG_MM_FREE_DELAYCOUNT_MAX > 0
|
||||
@@ -1397,8 +1397,8 @@ FAR void *mm_realloc(FAR struct mm_heap_s *heap, FAR void *oldmem,
|
||||
memdump_backtrace(heap, buf);
|
||||
#endif
|
||||
|
||||
sched_note_heap(false, heap, oldmem, oldsize);
|
||||
sched_note_heap(true, heap, newmem, newsize);
|
||||
sched_note_heap(NOTE_HEAP_FREE, heap, oldmem, oldsize);
|
||||
sched_note_heap(NOTE_HEAP_ALLOC, heap, newmem, newsize);
|
||||
}
|
||||
|
||||
#if CONFIG_MM_FREE_DELAYCOUNT_MAX > 0
|
||||
|
||||
Reference in New Issue
Block a user