Commit b7257530 authored by gerald's avatar gerald
Browse files

* 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
parent 2e27bc79
2003-07-14 Dan Nicolaescu <dann@ics.uci.edu>
* ggc-page.c (extra_order_size_table): Insns have 9 slots. Regs
don't have 2.
2003-07-14 Dan Nicolaescu <dann@ics.uci.edu>
* 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.
2003-07-14 James A. Morrison <ja2morri@student.math.uwaterloo.ca>
* doc/include/texinfo.tex: Upgrade to texinfo 4.6.
2003-07-14 Franz Sirl <Franz.Sirl-kernel@lauterbach.com>
 
PR optimization/11440
......
This diff is collapsed.
......@@ -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
......
......@@ -51,28 +51,11 @@ extern int _obstack_allocated_p (struct obstack *h, void *obj);
#ifdef GATHER_STATISTICS
/* Statistics-gathering stuff. */
typedef enum
{
d_kind,
t_kind,
b_kind,
s_kind,
r_kind,
e_kind,
c_kind,
id_kind,
perm_list_kind,
temp_list_kind,
vec_kind,
x_kind,
lang_decl,
lang_type,
all_kinds
} tree_node_kind;
int tree_node_counts[(int) all_kinds];
int tree_node_sizes[(int) all_kinds];
/* Keep in sync with tree.h:enum tree_node_kind. */
static const char * const tree_node_kind_names[] = {
"decls",
"types",
......@@ -4446,19 +4429,19 @@ dump_tree_statistics (void)
fprintf (stderr, "\n??? tree nodes created\n\n");
#ifdef GATHER_STATISTICS
fprintf (stderr, "Kind Nodes Bytes\n");
fprintf (stderr, "-------------------------------------\n");
fprintf (stderr, "Kind Nodes Bytes\n");
fprintf (stderr, "---------------------------------------\n");
total_nodes = total_bytes = 0;
for (i = 0; i < (int) all_kinds; i++)
{
fprintf (stderr, "%-20s %6d %9d\n", tree_node_kind_names[i],
fprintf (stderr, "%-20s %7d %10d\n", tree_node_kind_names[i],
tree_node_counts[i], tree_node_sizes[i]);
total_nodes += tree_node_counts[i];
total_bytes += tree_node_sizes[i];
}
fprintf (stderr, "-------------------------------------\n");
fprintf (stderr, "%-20s %6d %9d\n", "Total", total_nodes, total_bytes);
fprintf (stderr, "-------------------------------------\n");
fprintf (stderr, "---------------------------------------\n");
fprintf (stderr, "%-20s %7d %10d\n", "Total", total_nodes, total_bytes);
fprintf (stderr, "---------------------------------------\n");
#else
fprintf (stderr, "(No per-node statistics)\n");
#endif
......
......@@ -3017,4 +3017,28 @@ extern void fancy_abort (const char *, int, const char *)
ATTRIBUTE_NORETURN;
#define abort() fancy_abort (__FILE__, __LINE__, __FUNCTION__)
/* Enum and arrays used for tree allocation stats.
Keep in sync with tree.c:tree_node_kind_names. */
typedef enum
{
d_kind,
t_kind,
b_kind,
s_kind,
r_kind,
e_kind,
c_kind,
id_kind,
perm_list_kind,
temp_list_kind,
vec_kind,
x_kind,
lang_decl,
lang_type,
all_kinds
} tree_node_kind;
extern int tree_node_counts[];
extern int tree_node_sizes[];
#endif /* GCC_TREE_H */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment