diff options
author | Alexandre Oliva <aoliva@redhat.com> | 2013-09-20 11:10:55 -0300 |
---|---|---|
committer | Alexandre Oliva <aoliva@redhat.com> | 2013-09-20 11:48:45 -0300 |
commit | 6999d38c953e568f0488572c0a68cba32286a2c3 (patch) | |
tree | 99a89852bc0690da122ed6795fae947ff38ce69b /malloc/arena.c | |
parent | 0653427fdb5b70b8e1fc6189b0e7bdfc6ec920d6 (diff) | |
download | glibc-6999d38c953e568f0488572c0a68cba32286a2c3.tar.gz |
Add probes for malloc arena changes.
for ChangeLog
* malloc/arena.c (get_free_list): Add probe
memory_arena_reuse_free_list.
(reused_arena) [PER_THREAD]: Add probes memory_arena_reuse_wait
and memory_arena_reuse.
(arena_get2) [!PER_THREAD]: Likewise.
* malloc/malloc.c (__libc_realloc) [!PER_THREAD]: Add probe
memory_arena_reuse_realloc.
* manual/probes.texi: Document them.
Diffstat (limited to 'malloc/arena.c')
-rw-r--r-- | malloc/arena.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/malloc/arena.c b/malloc/arena.c index 0822fc85d5..89e8b926ae 100644 --- a/malloc/arena.c +++ b/malloc/arena.c @@ -775,6 +775,7 @@ get_free_list (void) if (result != NULL) { + LIBC_PROBE (memory_arena_reuse_free_list, 1, result); (void)mutex_lock(&result->mutex); tsd_setspecific(arena_key, (void *)result); THREAD_STAT(++(result->stat_lock_loop)); @@ -811,9 +812,11 @@ reused_arena (mstate avoid_arena) result = result->next; /* No arena available. Wait for the next in line. */ + LIBC_PROBE (memory_arena_reuse_wait, 3, &result->mutex, result, avoid_arena); (void)mutex_lock(&result->mutex); out: + LIBC_PROBE (memory_arena_reuse, 2, result, avoid_arena); tsd_setspecific(arena_key, (void *)result); THREAD_STAT(++(result->stat_lock_loop)); next_to_use = result->next; @@ -892,6 +895,7 @@ arena_get2(mstate a_tsd, size_t size, mstate avoid_arena) if (retried) (void)mutex_unlock(&list_lock); THREAD_STAT(++(a->stat_lock_loop)); + LIBC_PROBE (memory_arena_reuse, 2, a, a_tsd); tsd_setspecific(arena_key, (void *)a); return a; } @@ -904,6 +908,7 @@ arena_get2(mstate a_tsd, size_t size, mstate avoid_arena) locks. */ if(!retried && mutex_trylock(&list_lock)) { /* We will block to not run in a busy loop. */ + LIBC_PROBE (memory_arena_reuse_wait, 3, &list_lock, NULL, a_tsd); (void)mutex_lock(&list_lock); /* Since we blocked there might be an arena available now. */ |