mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-29 11:41:21 +03:00
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.
This commit is contained in:
@ -1,3 +1,12 @@
|
|||||||
|
2013-09-20 Alexandre Oliva <aoliva@redhat.com>
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
2013-09-19 Wei-Lun Chao <bluebat@member.fsf.org>
|
2013-09-19 Wei-Lun Chao <bluebat@member.fsf.org>
|
||||||
|
|
||||||
[BZ #15963, #13985]
|
[BZ #15963, #13985]
|
||||||
|
@ -736,6 +736,7 @@ _int_new_arena(size_t size)
|
|||||||
top(a) = (mchunkptr)ptr;
|
top(a) = (mchunkptr)ptr;
|
||||||
set_head(top(a), (((char*)h + h->size) - ptr) | PREV_INUSE);
|
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);
|
tsd_setspecific(arena_key, (void *)a);
|
||||||
mutex_init(&a->mutex);
|
mutex_init(&a->mutex);
|
||||||
(void)mutex_lock(&a->mutex);
|
(void)mutex_lock(&a->mutex);
|
||||||
|
@ -1878,6 +1878,8 @@ static int perturb_byte;
|
|||||||
#define free_perturb(p, n) memset (p, perturb_byte & 0xff, n)
|
#define free_perturb(p, n) memset (p, perturb_byte & 0xff, n)
|
||||||
|
|
||||||
|
|
||||||
|
#include <stap-probe.h>
|
||||||
|
|
||||||
/* ------------------- Support for multiple arenas -------------------- */
|
/* ------------------- Support for multiple arenas -------------------- */
|
||||||
#include "arena.c"
|
#include "arena.c"
|
||||||
|
|
||||||
@ -4695,6 +4697,8 @@ int __libc_mallopt(int param_number, int value)
|
|||||||
/* Ensure initialization/consolidation */
|
/* Ensure initialization/consolidation */
|
||||||
malloc_consolidate(av);
|
malloc_consolidate(av);
|
||||||
|
|
||||||
|
LIBC_PROBE (memory_mallopt, 2, param_number, value);
|
||||||
|
|
||||||
switch(param_number) {
|
switch(param_number) {
|
||||||
case M_MXFAST:
|
case M_MXFAST:
|
||||||
if (value >= 0 && value <= MAX_FAST_SIZE) {
|
if (value >= 0 && value <= MAX_FAST_SIZE) {
|
||||||
|
@ -42,7 +42,7 @@ chapters = $(addsuffix .texi, \
|
|||||||
message search pattern io stdio llio filesys \
|
message search pattern io stdio llio filesys \
|
||||||
pipe socket terminal syslog math arith time \
|
pipe socket terminal syslog math arith time \
|
||||||
resource setjmp signal startup process job nss \
|
resource setjmp signal startup process job nss \
|
||||||
users sysinfo conf crypt debug threads)
|
users sysinfo conf crypt debug threads probes)
|
||||||
add-chapters = $(wildcard $(foreach d, $(add-ons), ../$d/$d.texi))
|
add-chapters = $(wildcard $(foreach d, $(add-ons), ../$d/$d.texi))
|
||||||
appendices = lang.texi header.texi install.texi maint.texi platform.texi \
|
appendices = lang.texi header.texi install.texi maint.texi platform.texi \
|
||||||
contrib.texi
|
contrib.texi
|
||||||
|
41
manual/probes.texi
Normal file
41
manual/probes.texi
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
@node Internal Probes
|
||||||
|
@c @node Internal Probes, , POSIX Threads, Top
|
||||||
|
@c %MENU% Probes to monitor libc internal behavior
|
||||||
|
@chapter Internal probes
|
||||||
|
|
||||||
|
In order to aid in debugging and monitoring internal behavior,
|
||||||
|
@theglibc{} exposes nearly-zero-overhead SystemTap probes marked with
|
||||||
|
the @code{libc} provider.
|
||||||
|
|
||||||
|
These probes are not part of the @glibcadj{} stable ABI, and they are
|
||||||
|
subject to change or removal across releases. Our only promise with
|
||||||
|
regard to them is that, if we find a need to remove or modify the
|
||||||
|
arguments of a probe, the modified probe will have a different name, so
|
||||||
|
that program monitors relying on the old probe will not get unexpected
|
||||||
|
arguments.
|
||||||
|
|
||||||
|
@menu
|
||||||
|
* Memory Allocation Probes:: Probes in the memory allocation subsystem
|
||||||
|
@end menu
|
||||||
|
|
||||||
|
@node Memory Allocation Probes
|
||||||
|
@section Memory Allocation Probes
|
||||||
|
|
||||||
|
These probes are designed to signal relatively unusual situations within
|
||||||
|
the virtual memory subsystem of @theglibc{}.
|
||||||
|
|
||||||
|
@deftp Probe memory_arena_new (void *@var{$arg1}, size_t @var{$arg2})
|
||||||
|
This probe is triggered when @code{malloc} allocates and initializes an
|
||||||
|
additional arena (not the main arena), but before the arena is assigned
|
||||||
|
to the running thread or inserted into the internal linked list of
|
||||||
|
arenas. The arena's @code{malloc_state} internal data structure is
|
||||||
|
located at @var{$arg1}, within a newly-allocated heap big enough to hold
|
||||||
|
at least @var{$arg2} bytes.
|
||||||
|
@end deftp
|
||||||
|
|
||||||
|
@deftp Probe memory_mallopt (int @var{$arg1}, int @var{$arg2})
|
||||||
|
This probe is triggered when function @code{mallopt} is called to change
|
||||||
|
@code{malloc} internal configuration parameters, before any change to
|
||||||
|
the parameters is made. The arguments @var{$arg1} and @var{$arg2} are
|
||||||
|
the ones passed to the @code{mallopt} function.
|
||||||
|
@end deftp
|
@ -1,5 +1,5 @@
|
|||||||
@node POSIX Threads
|
@node POSIX Threads
|
||||||
@c @node POSIX Threads, , Cryptographic Functions, Top
|
@c @node POSIX Threads, Intenal Probes, Cryptographic Functions, Top
|
||||||
@chapter POSIX Threads
|
@chapter POSIX Threads
|
||||||
@c %MENU% POSIX Threads
|
@c %MENU% POSIX Threads
|
||||||
@cindex pthreads
|
@cindex pthreads
|
||||||
|
Reference in New Issue
Block a user