summaryrefslogtreecommitdiff
path: root/gcc/ggc-page.c
diff options
context:
space:
mode:
authorgerald <gerald@138bc75d-0d04-0410-961f-82ee72b054a4>2003-07-14 13:36:56 +0000
committergerald <gerald@138bc75d-0d04-0410-961f-82ee72b054a4>2003-07-14 13:36:56 +0000
commitb7257530a798765873c24cc12050dcf1cccf1211 (patch)
tree47bd6d886c5f588b7ab757036ddad7e0ef31691b /gcc/ggc-page.c
parent2e27bc79b78b99e7abd5bff1a1d8d76c2b8f9ebb (diff)
downloadgcc-b7257530a798765873c24cc12050dcf1cccf1211.tar.gz
* ggc-page.c (extra_order_size_table): Insns have 9 slots. Regs
don't have 2. * ggc-page.c (struct globals): Add new fields to keep track of the total allocated memory and overhead. (ggc_print_statistics): Print them. (ggc_alloc): Keep track of the total allocated memory and the overhead. * tree.c (dump_tree_statistics): Increase spacing. (enum tree_node_kind): Move to ... * tree.h (enum tree_node_kind): ... here. (tree_node_counts, tree_node_sizes): Declare. * doc/include/texinfo.tex: Upgrade to texinfo 4.6. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@69330 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ggc-page.c')
-rw-r--r--gcc/ggc-page.c82
1 files changed, 79 insertions, 3 deletions
diff --git a/gcc/ggc-page.c b/gcc/ggc-page.c
index 5063ccd18ba..0e5845be3f6 100644
--- a/gcc/ggc-page.c
+++ b/gcc/ggc-page.c
@@ -184,8 +184,8 @@ static const size_t extra_order_size_table[] = {
sizeof (struct tree_decl),
sizeof (struct tree_list),
TREE_EXP_SIZE (2),
- RTL_SIZE (2), /* REG, MEM, PLUS, etc. */
- RTL_SIZE (10), /* INSN, CALL_INSN, JUMP_INSN */
+ RTL_SIZE (2), /* MEM, PLUS, etc. */
+ RTL_SIZE (9), /* INSN, CALL_INSN, JUMP_INSN */
};
/* The total number of orders. */
@@ -400,6 +400,31 @@ static struct globals
better runtime data access pattern. */
unsigned long **save_in_use;
+#ifdef GATHER_STATISTICS
+ struct
+ {
+ /* Total memory allocated with ggc_alloc */
+ unsigned long long total_allocated;
+ /* 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.
+ These sizes are interesting because they are typical cache line
+ sizes. */
+
+ unsigned long long total_allocated_under32;
+ unsigned long long total_overhead_under32;
+
+ unsigned long long total_allocated_under64;
+ unsigned long long total_overhead_under64;
+
+ unsigned long long total_allocated_under128;
+ unsigned long long total_overhead_under128;
+
+ /* The overhead for each of the allocation orders. */
+ unsigned long long total_overhead_per_order[NUM_ORDERS];
+ } stats;
+#endif
} G;
/* The size in bytes required to maintain a bitmap for the objects
@@ -1123,6 +1148,30 @@ ggc_alloc (size_t size)
information is used in deciding when to collect. */
G.allocated += OBJECT_SIZE (order);
+#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);
+
+ if (size <= 32){
+ G.stats.total_overhead_under32 += OBJECT_SIZE (order) - size;
+ G.stats.total_allocated_under32 += OBJECT_SIZE(order);
+ }
+
+ if (size <= 64){
+ G.stats.total_overhead_under64 += OBJECT_SIZE (order) - size;
+ G.stats.total_allocated_under64 += OBJECT_SIZE(order);
+ }
+
+ if (size <= 128){
+ G.stats.total_overhead_under128 += OBJECT_SIZE (order) - size;
+ G.stats.total_allocated_under128 += OBJECT_SIZE(order);
+ }
+
+ }
+#endif
+
if (GGC_DEBUG_LEVEL >= 3)
fprintf (G.debug_file,
"Allocating object, requested size=%lu, actual=%lu at %p on %p\n",
@@ -1761,7 +1810,7 @@ ggc_print_statistics (void)
/* Collect some information about the various sizes of
allocation. */
- fprintf (stderr, "\n%-5s %10s %10s %10s\n",
+ fprintf (stderr, "%-5s %10s %10s %10s\n",
"Size", "Allocated", "Used", "Overhead");
for (i = 0; i < NUM_ORDERS; ++i)
{
@@ -1799,6 +1848,33 @@ ggc_print_statistics (void)
SCALE (G.bytes_mapped), LABEL (G.bytes_mapped),
SCALE (G.allocated), LABEL(G.allocated),
SCALE (total_overhead), LABEL (total_overhead));
+
+#ifdef GATHER_STATISTICS
+ {
+ fprintf (stderr, "Total Overhead: %10lld\n",
+ G.stats.total_overhead);
+ fprintf (stderr, "Total Allocated: %10lld\n",
+ G.stats.total_allocated);
+
+ fprintf (stderr, "Total Overhead under 32B: %10lld\n",
+ G.stats.total_overhead_under32);
+ fprintf (stderr, "Total Allocated under 32B: %10lld\n",
+ G.stats.total_allocated_under32);
+ fprintf (stderr, "Total Overhead under 64B: %10lld\n",
+ G.stats.total_overhead_under64);
+ fprintf (stderr, "Total Allocated under 64B: %10lld\n",
+ G.stats.total_allocated_under64);
+ fprintf (stderr, "Total Overhead under 128B: %10lld\n",
+ G.stats.total_overhead_under128);
+ fprintf (stderr, "Total Allocated under 128B: %10lld\n",
+ 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]);
+ }
+#endif
}
struct ggc_pch_data