1 /* mstats.h - definitions for malloc statistics */
3 /* Copyright (C) 2001-2003 Free Software Foundation, Inc.
5 This file is part of GNU Bash, the Bourne-Again SHell.
7 Bash is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
12 Bash is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with Bash. If not, see <http://www.gnu.org/licenses/>.
33 * NMALLOC[i] is the difference between the number of mallocs and frees
34 * for a given block size. TMALLOC[i] is the total number of mallocs for
35 * a given block size. NMORECORE[i] is the total number of calls to
36 * morecore(i). NLESSCORE[i] is the total number of calls to lesscore(i).
38 * NMAL and NFRE are counts of the number of calls to malloc() and free(),
39 * respectively. NREALLOC is the total number of calls to realloc();
40 * NRCOPY is the number of times realloc() had to allocate new memory and
41 * copy to it. NRECURSE is a count of the number of recursive calls to
42 * malloc() for the same bucket size, which can be caused by calls to
43 * malloc() from a signal handler.
45 * NSBRK is the number of calls to sbrk() (whether by morecore() or for
46 * alignment); TSBRK is the total number of bytes requested from the kernel
49 * BYTESUSED is the total number of bytes consumed by blocks currently in
50 * use; BYTESFREE is the total number of bytes currently on all of the free
51 * lists. BYTESREQ is the total number of bytes requested by the caller
52 * via calls to malloc() and realloc().
54 * TBSPLIT is the number of times a larger block was split to satisfy a
55 * smaller request. NSPLIT[i] is the number of times a block of size I was
58 * TBCOALESCE is the number of times two adjacent smaller blocks off the free
59 * list were combined to satisfy a larger request.
62 int nmalloc[NBUCKETS];
63 int tmalloc[NBUCKETS];
64 int nmorecore[NBUCKETS];
65 int nlesscore[NBUCKETS];
79 int ncoalesce[NBUCKETS];
82 /* Return statistics describing allocation of blocks of size BLOCKSIZE.
83 NFREE is the number of free blocks for this allocation size. NUSED
84 is the number of blocks in use. NMAL is the number of requests for
85 blocks of size BLOCKSIZE. NMORECORE is the number of times we had
86 to call MORECORE to repopulate the free list for this bucket.
87 NLESSCORE is the number of times we gave memory back to the system
88 from this bucket. NSPLIT is the number of times a block of this size
89 was split to satisfy a smaller request. NCOALESCE is the number of
90 times two blocks of this size were combined to satisfy a larger
103 extern struct bucket_stats malloc_bucket_stats __P((int));
104 extern struct _malstats malloc_stats __P((void));
105 extern void print_malloc_stats __P((char *));
106 extern void trace_malloc_stats __P((char *, char *));
108 #endif /* MALLOC_STATS */
110 #endif /* _MSTATS_H */