summaryrefslogtreecommitdiff
path: root/gcc/ggc-page.c
diff options
context:
space:
mode:
authorwilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4>2003-12-22 07:42:43 +0000
committerwilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4>2003-12-22 07:42:43 +0000
commit86736f9e33c4b7981d8a621728091a44afc91d36 (patch)
tree92e1b9a44d211c848fd96269a939fdf393e245ab /gcc/ggc-page.c
parent3167276382f4709bd9cc3007e410770ff6ba7161 (diff)
downloadgcc-86736f9e33c4b7981d8a621728091a44afc91d36.tar.gz
Patch from Dan Nicolaescu
* rtl.h (dump_rtx_statistics): Declare it. * rtl.c (rtx_alloc_counts, rtx_alloc_sizes, rtvec_alloc_counts, rtx_alloc_sizes): New static vars. (rtx_alloc, rtvec_alloc): Update them. (dump_rtx_statistics): New function. * toplev.c (finalize): Call it. * ggc-page.c (struct globals): Fix comments. Add new member total_allocated_per_order. (ggc_alloc): Keep track of the total allocated memory. (ggc_print_statistics): Clarify message. Print total allocated memory stats. * configure.in (gather-detailed-mem-stats): New flag. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi (Configuration): Document --enable-gather-detailed-mem-stats. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@74930 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ggc-page.c')
-rw-r--r--gcc/ggc-page.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/gcc/ggc-page.c b/gcc/ggc-page.c
index 0f734119f65..bf18e3f00d7 100644
--- a/gcc/ggc-page.c
+++ b/gcc/ggc-page.c
@@ -401,13 +401,12 @@ static struct globals
zero otherwise. We allocate them all together, to enable a
better runtime data access pattern. */
unsigned long **save_in_use;
-
#ifdef GATHER_STATISTICS
struct
{
- /* Total memory allocated with ggc_alloc */
+ /* Total memory allocated with ggc_alloc. */
unsigned long long total_allocated;
- /* Total overhead for memory to be allocated with ggc_alloc */
+ /* Total overhead for memory to be allocated with ggc_alloc. */
unsigned long long total_overhead;
/* Total allocations and overhead for sizes less than 32, 64 and 128.
@@ -423,6 +422,9 @@ static struct globals
unsigned long long total_allocated_under128;
unsigned long long total_overhead_under128;
+ /* The allocations for each of the allocation orders. */
+ unsigned long long total_allocated_per_order[NUM_ORDERS];
+
/* The overhead for each of the allocation orders. */
unsigned long long total_overhead_per_order[NUM_ORDERS];
} stats;
@@ -1171,8 +1173,9 @@ ggc_alloc (size_t size)
#ifdef GATHER_STATISTICS
{
G.stats.total_overhead += OBJECT_SIZE (order) - size;
- G.stats.total_overhead_per_order[order] += OBJECT_SIZE (order) - size;
G.stats.total_allocated += OBJECT_SIZE(order);
+ G.stats.total_overhead_per_order[order] += OBJECT_SIZE (order) - size;
+ G.stats.total_allocated_per_order[order] += OBJECT_SIZE (order);
if (size <= 32){
G.stats.total_overhead_under32 += OBJECT_SIZE (order) - size;
@@ -1844,6 +1847,8 @@ ggc_print_statistics (void)
/* Collect some information about the various sizes of
allocation. */
+ fprintf (stderr,
+ "Memory still allocated at the end of the compilation process\n");
fprintf (stderr, "%-5s %10s %10s %10s\n",
"Size", "Allocated", "Used", "Overhead");
for (i = 0; i < NUM_ORDERS; ++i)
@@ -1885,6 +1890,8 @@ ggc_print_statistics (void)
#ifdef GATHER_STATISTICS
{
+ fprintf (stderr, "\nTotal allocations and overheads during the compilation process\n");
+
fprintf (stderr, "Total Overhead: %10lld\n",
G.stats.total_overhead);
fprintf (stderr, "Total Allocated: %10lld\n",
@@ -1904,9 +1911,13 @@ ggc_print_statistics (void)
G.stats.total_allocated_under128);
for (i = 0; i < NUM_ORDERS; i++)
- if (G.stats.total_overhead_per_order[i])
- fprintf (stderr, "Total Overhead page size %7d: %10lld\n",
- OBJECT_SIZE (i), G.stats.total_overhead_per_order[i]);
+ if (G.stats.total_allocated_per_order[i])
+ {
+ fprintf (stderr, "Total Overhead page size %7d: %10lld\n",
+ OBJECT_SIZE (i), G.stats.total_overhead_per_order[i]);
+ fprintf (stderr, "Total Allocated page size %7d: %10lld\n",
+ OBJECT_SIZE (i), G.stats.total_allocated_per_order[i]);
+ }
}
#endif
}