summaryrefslogtreecommitdiff
path: root/malloc/arena.c
diff options
context:
space:
mode:
authorAlexandre Oliva <aoliva@redhat.com>2013-09-20 11:10:56 -0300
committerAlexandre Oliva <aoliva@redhat.com>2013-09-20 11:54:58 -0300
commit322dea08387167e3c3a9c9b60325ebafa264bd77 (patch)
tree7239f9202a5035c424b38196868cec5cb28b45a4 /malloc/arena.c
parent655673f312318a9d95b71ef9f95a59ff36b0a487 (diff)
Add malloc probes for sbrk and heap resizing.
for ChangeLog * malloc/arena.c (new_heap): New memory_heap_new probe. (grow_heap): New memory_heap_more probe. (shrink_heap): New memory_heap_less probe. (heap_trim): New memory_heap_free probe. * malloc/malloc.c (sysmalloc): New memory_sbrk_more probe. (systrim): New memory_sbrk_less probe. * manual/probes.texi: Document them.
Diffstat (limited to 'malloc/arena.c')
-rw-r--r--malloc/arena.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/malloc/arena.c b/malloc/arena.c
index 9ace186f5a..d81ed0d680 100644
--- a/malloc/arena.c
+++ b/malloc/arena.c
@@ -581,6 +581,7 @@ new_heap(size_t size, size_t top_pad)
h->size = size;
h->mprotect_size = size;
THREAD_STAT(stat_n_heaps++);
+ LIBC_PROBE (memory_heap_new, 2, h, h->size);
return h;
}
@@ -606,6 +607,7 @@ grow_heap(heap_info *h, long diff)
}
h->size = new_size;
+ LIBC_PROBE (memory_heap_more, 2, h, h->size);
return 0;
}
@@ -633,6 +635,7 @@ shrink_heap(heap_info *h, long diff)
/*fprintf(stderr, "shrink %p %08lx\n", h, new_size);*/
h->size = new_size;
+ LIBC_PROBE (memory_heap_less, 2, h, h->size);
return 0;
}
@@ -674,6 +677,7 @@ heap_trim(heap_info *heap, size_t pad)
break;
ar_ptr->system_mem -= heap->size;
arena_mem -= heap->size;
+ LIBC_PROBE (memory_heap_free, 2, heap, heap->size);
delete_heap(heap);
heap = prev_heap;
if(!prev_inuse(p)) { /* consolidate backward */