Commit b2b43e33 by Martin Liska Committed by Martin Liska

Fix memory report layout at various places.

	* alloc-pool.h (struct pool_usage): Correct space padding.
	* ggc-page.c (ggc_print_statistics): Align columns in a report.
	* mem-stats.h (struct mem_usage): Add argument to print_dash_line.
	* tree.c (dump_tree_statistics): Align columns in a report.

From-SVN: r224071
parent ac059261
2015-06-03 Martin Liska <mliska@suse.cz> 2015-06-03 Martin Liska <mliska@suse.cz>
* alloc-pool.h (struct pool_usage): Correct space padding.
* ggc-page.c (ggc_print_statistics): Align columns in a report.
* mem-stats.h (struct mem_usage): Add argument to print_dash_line.
* tree.c (dump_tree_statistics): Align columns in a report.
2015-06-03 Martin Liska <mliska@suse.cz>
* alloc-pool.c (allocate_pool_descriptor): Remove. * alloc-pool.c (allocate_pool_descriptor): Remove.
(struct pool_output_info): Likewise. (struct pool_output_info): Likewise.
(print_alloc_pool_statistics): Likewise. (print_alloc_pool_statistics): Likewise.
......
...@@ -76,7 +76,7 @@ struct pool_usage: public mem_usage ...@@ -76,7 +76,7 @@ struct pool_usage: public mem_usage
inline void dump_footer () inline void dump_footer ()
{ {
print_dash_line (); print_dash_line ();
fprintf (stderr, "%s%75li%10li\n", "Total", (long)m_instances, fprintf (stderr, "%s%82li%10li\n", "Total", (long)m_instances,
(long)m_allocated); (long)m_allocated);
print_dash_line (); print_dash_line ();
} }
......
...@@ -2268,7 +2268,7 @@ ggc_print_statistics (void) ...@@ -2268,7 +2268,7 @@ ggc_print_statistics (void)
allocation. */ allocation. */
fprintf (stderr, fprintf (stderr,
"Memory still allocated at the end of the compilation process\n"); "Memory still allocated at the end of the compilation process\n");
fprintf (stderr, "%-5s %10s %10s %10s\n", fprintf (stderr, "%-8s %10s %10s %10s\n",
"Size", "Allocated", "Used", "Overhead"); "Size", "Allocated", "Used", "Overhead");
for (i = 0; i < NUM_ORDERS; ++i) for (i = 0; i < NUM_ORDERS; ++i)
{ {
...@@ -2295,47 +2295,51 @@ ggc_print_statistics (void) ...@@ -2295,47 +2295,51 @@ ggc_print_statistics (void)
overhead += (sizeof (page_entry) - sizeof (long) overhead += (sizeof (page_entry) - sizeof (long)
+ BITMAP_SIZE (OBJECTS_IN_PAGE (p) + 1)); + BITMAP_SIZE (OBJECTS_IN_PAGE (p) + 1));
} }
fprintf (stderr, "%-5lu %10lu%c %10lu%c %10lu%c\n", fprintf (stderr, "%-8lu %10lu%c %10lu%c %10lu%c\n",
(unsigned long) OBJECT_SIZE (i), (unsigned long) OBJECT_SIZE (i),
SCALE (allocated), STAT_LABEL (allocated), SCALE (allocated), STAT_LABEL (allocated),
SCALE (in_use), STAT_LABEL (in_use), SCALE (in_use), STAT_LABEL (in_use),
SCALE (overhead), STAT_LABEL (overhead)); SCALE (overhead), STAT_LABEL (overhead));
total_overhead += overhead; total_overhead += overhead;
} }
fprintf (stderr, "%-5s %10lu%c %10lu%c %10lu%c\n", "Total", fprintf (stderr, "%-8s %10lu%c %10lu%c %10lu%c\n", "Total",
SCALE (G.bytes_mapped), STAT_LABEL (G.bytes_mapped), SCALE (G.bytes_mapped), STAT_LABEL (G.bytes_mapped),
SCALE (G.allocated), STAT_LABEL (G.allocated), SCALE (G.allocated), STAT_LABEL (G.allocated),
SCALE (total_overhead), STAT_LABEL (total_overhead)); SCALE (total_overhead), STAT_LABEL (total_overhead));
if (GATHER_STATISTICS) if (GATHER_STATISTICS)
{ {
fprintf (stderr, "\nTotal allocations and overheads during the compilation process\n"); fprintf (stderr, "\nTotal allocations and overheads during "
"the compilation process\n");
fprintf (stderr, "Total Overhead: %10" HOST_LONG_LONG_FORMAT "d\n", fprintf (stderr, "Total Overhead: %10"
G.stats.total_overhead); HOST_LONG_LONG_FORMAT "d\n", G.stats.total_overhead);
fprintf (stderr, "Total Allocated: %10" HOST_LONG_LONG_FORMAT "d\n", fprintf (stderr, "Total Allocated: %10"
HOST_LONG_LONG_FORMAT "d\n",
G.stats.total_allocated); G.stats.total_allocated);
fprintf (stderr, "Total Overhead under 32B: %10" HOST_LONG_LONG_FORMAT "d\n", fprintf (stderr, "Total Overhead under 32B: %10"
G.stats.total_overhead_under32); HOST_LONG_LONG_FORMAT "d\n", G.stats.total_overhead_under32);
fprintf (stderr, "Total Allocated under 32B: %10" HOST_LONG_LONG_FORMAT "d\n", fprintf (stderr, "Total Allocated under 32B: %10"
G.stats.total_allocated_under32); HOST_LONG_LONG_FORMAT "d\n", G.stats.total_allocated_under32);
fprintf (stderr, "Total Overhead under 64B: %10" HOST_LONG_LONG_FORMAT "d\n", fprintf (stderr, "Total Overhead under 64B: %10"
G.stats.total_overhead_under64); HOST_LONG_LONG_FORMAT "d\n", G.stats.total_overhead_under64);
fprintf (stderr, "Total Allocated under 64B: %10" HOST_LONG_LONG_FORMAT "d\n", fprintf (stderr, "Total Allocated under 64B: %10"
G.stats.total_allocated_under64); HOST_LONG_LONG_FORMAT "d\n", G.stats.total_allocated_under64);
fprintf (stderr, "Total Overhead under 128B: %10" HOST_LONG_LONG_FORMAT "d\n", fprintf (stderr, "Total Overhead under 128B: %10"
G.stats.total_overhead_under128); HOST_LONG_LONG_FORMAT "d\n", G.stats.total_overhead_under128);
fprintf (stderr, "Total Allocated under 128B: %10" HOST_LONG_LONG_FORMAT "d\n", fprintf (stderr, "Total Allocated under 128B: %10"
G.stats.total_allocated_under128); HOST_LONG_LONG_FORMAT "d\n", G.stats.total_allocated_under128);
for (i = 0; i < NUM_ORDERS; i++) for (i = 0; i < NUM_ORDERS; i++)
if (G.stats.total_allocated_per_order[i]) if (G.stats.total_allocated_per_order[i])
{ {
fprintf (stderr, "Total Overhead page size %7lu: %10" HOST_LONG_LONG_FORMAT "d\n", fprintf (stderr, "Total Overhead page size %9lu: %10"
HOST_LONG_LONG_FORMAT "d\n",
(unsigned long) OBJECT_SIZE (i), (unsigned long) OBJECT_SIZE (i),
G.stats.total_overhead_per_order[i]); G.stats.total_overhead_per_order[i]);
fprintf (stderr, "Total Allocated page size %7lu: %10" HOST_LONG_LONG_FORMAT "d\n", fprintf (stderr, "Total Allocated page size %9lu: %10"
HOST_LONG_LONG_FORMAT "d\n",
(unsigned long) OBJECT_SIZE (i), (unsigned long) OBJECT_SIZE (i),
G.stats.total_allocated_per_order[i]); G.stats.total_allocated_per_order[i]);
} }
......
...@@ -185,9 +185,9 @@ struct mem_usage ...@@ -185,9 +185,9 @@ struct mem_usage
} }
/* Print line made of dashes. */ /* Print line made of dashes. */
static inline void print_dash_line () static inline void print_dash_line (size_t count = 140)
{ {
fprintf (stderr, "%s\n", std::string (140, '-').c_str ()); fprintf (stderr, "%s\n", std::string (count, '-').c_str ());
} }
/* Dump header with NAME. */ /* Dump header with NAME. */
......
...@@ -9156,6 +9156,8 @@ get_callee_fndecl (const_tree call) ...@@ -9156,6 +9156,8 @@ get_callee_fndecl (const_tree call)
return NULL_TREE; return NULL_TREE;
} }
#define TREE_MEM_USAGE_SPACES 40
/* Print debugging information about tree nodes generated during the compile, /* Print debugging information about tree nodes generated during the compile,
and any language-specific information. */ and any language-specific information. */
...@@ -9166,8 +9168,8 @@ dump_tree_statistics (void) ...@@ -9166,8 +9168,8 @@ dump_tree_statistics (void)
{ {
int i; int i;
int total_nodes, total_bytes; int total_nodes, total_bytes;
fprintf (stderr, "Kind Nodes Bytes\n"); fprintf (stderr, "\nKind Nodes Bytes\n");
fprintf (stderr, "---------------------------------------\n"); mem_usage::print_dash_line (TREE_MEM_USAGE_SPACES);
total_nodes = total_bytes = 0; total_nodes = total_bytes = 0;
for (i = 0; i < (int) all_kinds; i++) for (i = 0; i < (int) all_kinds; i++)
{ {
...@@ -9176,17 +9178,20 @@ dump_tree_statistics (void) ...@@ -9176,17 +9178,20 @@ dump_tree_statistics (void)
total_nodes += tree_node_counts[i]; total_nodes += tree_node_counts[i];
total_bytes += tree_node_sizes[i]; total_bytes += tree_node_sizes[i];
} }
fprintf (stderr, "---------------------------------------\n"); mem_usage::print_dash_line (TREE_MEM_USAGE_SPACES);
fprintf (stderr, "%-20s %7d %10d\n", "Total", total_nodes, total_bytes); fprintf (stderr, "%-20s %7d %10d\n", "Total", total_nodes, total_bytes);
fprintf (stderr, "---------------------------------------\n"); mem_usage::print_dash_line (TREE_MEM_USAGE_SPACES);
fprintf (stderr, "Code Nodes\n"); fprintf (stderr, "Code Nodes\n");
fprintf (stderr, "----------------------------\n"); mem_usage::print_dash_line (TREE_MEM_USAGE_SPACES);
for (i = 0; i < (int) MAX_TREE_CODES; i++) for (i = 0; i < (int) MAX_TREE_CODES; i++)
fprintf (stderr, "%-20s %7d\n", get_tree_code_name ((enum tree_code) i), fprintf (stderr, "%-32s %7d\n", get_tree_code_name ((enum tree_code) i),
tree_code_counts[i]); tree_code_counts[i]);
fprintf (stderr, "----------------------------\n"); mem_usage::print_dash_line (TREE_MEM_USAGE_SPACES);
fprintf (stderr, "\n");
ssanames_print_statistics (); ssanames_print_statistics ();
fprintf (stderr, "\n");
phinodes_print_statistics (); phinodes_print_statistics ();
fprintf (stderr, "\n");
} }
else else
fprintf (stderr, "(No per-node statistics)\n"); fprintf (stderr, "(No per-node statistics)\n");
......
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