- unsigned int i;
- unsigned int total;
-
- total = 0;
- for (i = 0; i < n_bins; i++)
- total += bins[i];
-
- if (!total)
- return;
-
- fprintf (file, "%s %s", name, msg);
- for (i = 0; i < n_bins; i++)
- fprintf (file, "%.0f-%.0f%%\t%8d (%5.1f%%)\n",
- i * 100.0 / n_bins,
- (i + 1) * 100.0 / n_bins, bins[i],
- (100.0 * bins[i]) / total);
-}
-
-
-/* Print a log histogram with message MSG to FILE. */
-static void
-bitset_log_histogram_print (file, name, msg, n_bins, bins)
- FILE *file;
- const char *name;
- const char *msg;
- unsigned int n_bins;
- unsigned int *bins;
-{
- unsigned int i;
- unsigned int total;
- unsigned int max_width;
-
- total = 0;
- for (i = 0; i < n_bins; i++)
- total += bins[i];
-
- if (!total)
- return;
-
- /* 2 * ceil (log10(2) * (N - 1)) + 1 */
- max_width = 2 * (unsigned int) (0.30103 * (n_bins - 1) + 0.9999) + 1;
-
- fprintf (file, "%s %s", name, msg);
- for (i = 0; i < 2; i++)
- fprintf (file, "%*d\t%8d (%5.1f%%)\n",
- max_width, i, bins[i], 100.0 * bins[i] / total);
-
- /* Perhaps we should bail out once the histogram goes to zero. */
- for (; i < n_bins; i++)
- fprintf (file, "%*d-%d\t%8d (%5.1f%%)\n",
- max_width - ((unsigned int) (0.30103 * (i) + 0.9999) + 1),
- 1 << (i - 1), (1 << i) - 1, bins[i],
- (100.0 * bins[i]) / total);
-}
-
-
-/* Print bitset statistics to FILE. */
-static void
-bitset_stats_print_1 (file, name, stats)
- FILE *file;
- const char *name;
- struct bitset_type_stats_struct *stats;
-{
- if (!stats)
- return;
-
- fprintf (file, "%d %ss xmalloced, %d freed.\n",
- stats->xmallocs, name, stats->xfrees);
- fprintf (file, "%d %ss oballoced, %d freed.\n",
- stats->oballocs, name, stats->obfrees);
-
- fprintf (file, "%d bitset_lists\n", stats->lists);
-
- bitset_log_histogram_print (file, name, "count log histogram\n",
- BITSET_LOG_COUNT_BINS, stats->list_counts);
-
- bitset_log_histogram_print (file, name, "size log histogram\n",
- BITSET_LOG_SIZE_BINS, stats->list_sizes);
-
- bitset_percent_histogram_print (file, name, "density histogram\n",
- BITSET_DENSITY_BINS, stats->list_density);