summaryrefslogtreecommitdiff
path: root/gcc/stringpool.c
diff options
context:
space:
mode:
authorzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2000-11-22 00:18:18 +0000
committerzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2000-11-22 00:18:18 +0000
commitc4fb66accaaaf12b786f84e8aec9f04e875cc75b (patch)
treee887ed32697fcd124a74f19e4d01ea9aa3657f62 /gcc/stringpool.c
parent5adb97c0bf6eb58e214468dc6340ef61e5d15ae1 (diff)
downloadgcc-c4fb66accaaaf12b786f84e8aec9f04e875cc75b.tar.gz
* stringpool.c (stringpool_statistics): Also report number and
percentage of entries which are identifiers. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@37633 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/stringpool.c')
-rw-r--r--gcc/stringpool.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/gcc/stringpool.c b/gcc/stringpool.c
index 20db021009c..ceb454d9221 100644
--- a/gcc/stringpool.c
+++ b/gcc/stringpool.c
@@ -345,7 +345,7 @@ maybe_get_identifier (text)
void
stringpool_statistics ()
{
- size_t nelts, overhead, headers;
+ size_t nelts, nids, overhead, headers;
size_t total_bytes, longest, sum_of_squares;
double exp_len, exp_len2, exp2_len;
struct str_header *e;
@@ -356,7 +356,7 @@ stringpool_statistics ()
: (x) / (1024*1024))))
#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)
{
size_t n = e->len;
@@ -365,6 +365,8 @@ stringpool_statistics ()
sum_of_squares += n*n;
if (n > longest)
longest = n;
+ if (e->data)
+ nids++;
}
nelts = string_hash.nelements;
@@ -374,10 +376,13 @@ stringpool_statistics ()
fprintf (stderr,
"\nString pool\n\
entries\t\t%lu\n\
+identifiers\t%lu (%.2f%%)\n\
slots\t\t%lu\n\
bytes\t\t%lu%c (%lu%c overhead)\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 (overhead), LABEL (overhead),
SCALE (headers), LABEL (headers));