Commit dfc55970 by Zack Weinberg Committed by Zack Weinberg

stringpool.c (stringpool_statistics): Also report number and percentage of…

stringpool.c (stringpool_statistics): Also report number and percentage of entries which are identifiers.

	* stringpool.c (stringpool_statistics): Also report number and
	percentage of entries which are identifiers.

From-SVN: r37633
parent 5feb272b
2000-11-21 Zack Weinberg <zack@wolery.stanford.edu>
* stringpool.c (stringpool_statistics): Also report number and
percentage of entries which are identifiers.
2000-11-21 Diego Novillo <dnovillo@redhat.com> 2000-11-21 Diego Novillo <dnovillo@redhat.com>
* gcse.c (hoist_expr_reaches_here_p): Do not mark expr_bb as * gcse.c (hoist_expr_reaches_here_p): Do not mark expr_bb as
......
...@@ -345,7 +345,7 @@ maybe_get_identifier (text) ...@@ -345,7 +345,7 @@ maybe_get_identifier (text)
void void
stringpool_statistics () stringpool_statistics ()
{ {
size_t nelts, overhead, headers; size_t nelts, nids, overhead, headers;
size_t total_bytes, longest, sum_of_squares; size_t total_bytes, longest, sum_of_squares;
double exp_len, exp_len2, exp2_len; double exp_len, exp_len2, exp2_len;
struct str_header *e; struct str_header *e;
...@@ -356,7 +356,7 @@ stringpool_statistics () ...@@ -356,7 +356,7 @@ stringpool_statistics ()
: (x) / (1024*1024)))) : (x) / (1024*1024))))
#define LABEL(x) ((x) < 1024*10 ? ' ' : ((x) < 1024*1024*10 ? 'k' : 'M')) #define LABEL(x) ((x) < 1024*10 ? ' ' : ((x) < 1024*1024*10 ? 'k' : 'M'))
total_bytes = longest = sum_of_squares = 0; total_bytes = longest = sum_of_squares = nids = 0;
FORALL_STRINGS (e) FORALL_STRINGS (e)
{ {
size_t n = e->len; size_t n = e->len;
...@@ -365,6 +365,8 @@ stringpool_statistics () ...@@ -365,6 +365,8 @@ stringpool_statistics ()
sum_of_squares += n*n; sum_of_squares += n*n;
if (n > longest) if (n > longest)
longest = n; longest = n;
if (e->data)
nids++;
} }
nelts = string_hash.nelements; nelts = string_hash.nelements;
...@@ -374,10 +376,13 @@ stringpool_statistics () ...@@ -374,10 +376,13 @@ stringpool_statistics ()
fprintf (stderr, fprintf (stderr,
"\nString pool\n\ "\nString pool\n\
entries\t\t%lu\n\ entries\t\t%lu\n\
identifiers\t%lu (%.2f%%)\n\
slots\t\t%lu\n\ slots\t\t%lu\n\
bytes\t\t%lu%c (%lu%c overhead)\n\ bytes\t\t%lu%c (%lu%c overhead)\n\
table size\t%lu%c\n", table size\t%lu%c\n",
(unsigned long) nelts, (unsigned long) string_hash.nslots, (unsigned long) nelts,
(unsigned long) nids, nids * 100.0 / nelts,
(unsigned long) string_hash.nslots,
SCALE (total_bytes), LABEL (total_bytes), SCALE (total_bytes), LABEL (total_bytes),
SCALE (overhead), LABEL (overhead), SCALE (overhead), LABEL (overhead),
SCALE (headers), LABEL (headers)); SCALE (headers), LABEL (headers));
......
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