From 3ea5be54364ae3344aa7c5c51a1f29f56854b123 Mon Sep 17 00:00:00 2001 From: Alexandre Oliva Date: Fri, 20 Sep 2013 11:10:54 -0300 Subject: Add first set of memory probes. for ChangeLog * malloc/malloc.c: Include stap-probe.h. (__libc_mallopt): Add memory_mallopt probe. * malloc/arena.c (_int_new_arena): Add memory_arena_new probe. * manual/probes.texi: New. * manual/Makefile (chapters): Add probes. * manual/threads.texi: Set next node. --- malloc/arena.c | 1 + malloc/malloc.c | 4 ++++ 2 files changed, 5 insertions(+) (limited to 'malloc') diff --git a/malloc/arena.c b/malloc/arena.c index 12a48ad..0822fc8 100644 --- a/malloc/arena.c +++ b/malloc/arena.c @@ -736,6 +736,7 @@ _int_new_arena(size_t size) top(a) = (mchunkptr)ptr; set_head(top(a), (((char*)h + h->size) - ptr) | PREV_INUSE); + LIBC_PROBE (memory_arena_new, 2, a, size); tsd_setspecific(arena_key, (void *)a); mutex_init(&a->mutex); (void)mutex_lock(&a->mutex); diff --git a/malloc/malloc.c b/malloc/malloc.c index f7718a9..97ba34f 100644 --- a/malloc/malloc.c +++ b/malloc/malloc.c @@ -1878,6 +1878,8 @@ static int perturb_byte; #define free_perturb(p, n) memset (p, perturb_byte & 0xff, n) +#include + /* ------------------- Support for multiple arenas -------------------- */ #include "arena.c" @@ -4695,6 +4697,8 @@ int __libc_mallopt(int param_number, int value) /* Ensure initialization/consolidation */ malloc_consolidate(av); + LIBC_PROBE (memory_mallopt, 2, param_number, value); + switch(param_number) { case M_MXFAST: if (value >= 0 && value <= MAX_FAST_SIZE) { -- cgit v1.1