- 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;
-#define SCALE(x) ((unsigned long) ((x) < 1024*10 \
- ? (x) \
- : ((x) < 1024*1024*10 \
- ? (x) / 1024 \
- : (x) / (1024*1024))))
-#define LABEL(x) ((x) < 1024*10 ? ' ' : ((x) < 1024*1024*10 ? 'k' : 'M'))
-
- total_bytes = longest = sum_of_squares = nids = 0;
- FORALL_STRINGS (e)
- {
- size_t n = e->len;
-
- total_bytes += n;
- sum_of_squares += n*n;
- if (n > longest)
- longest = n;
- if (e->data)
- nids++;
- }
-
- nelts = string_hash.nelements;
- overhead = obstack_memory_used (&string_stack) - total_bytes;
- headers = string_hash.nslots * sizeof (struct str_header);
-
- 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) nids, nids * 100.0 / nelts,
- (unsigned long) string_hash.nslots,
- SCALE (total_bytes), LABEL (total_bytes),
- SCALE (overhead), LABEL (overhead),
- SCALE (headers), LABEL (headers));
-
- exp_len = (double)total_bytes / (double)nelts;
- exp2_len = exp_len * exp_len;
- exp_len2 = (double)sum_of_squares / (double)nelts;
-
- fprintf (stderr,
-"coll/search\t%.4f\n\
-ins/search\t%.4f\n\
-avg. entry\t%.2f bytes (+/- %.2f)\n\
-longest entry\t%lu\n",
- (double) string_hash.collisions / (double) string_hash.searches,
- (double) nelts / (double) string_hash.searches,
- exp_len, approx_sqrt (exp_len2 - exp2_len),
- (unsigned long) longest);
-#undef SCALE
-#undef LABEL