Commit 52dbe645 authored by Geoff Simmons's avatar Geoff Simmons

Add some more stats.

parent b4e64240
...@@ -444,14 +444,24 @@ PH_Stats(const struct ph * const restrict ph, ...@@ -444,14 +444,24 @@ PH_Stats(const struct ph * const restrict ph,
stats->minlen = ph->minlen; stats->minlen = ph->minlen;
stats->maxlen = ph->maxlen; stats->maxlen = ph->maxlen;
stats->h2buckets_min = UINT64_MAX;
for (unsigned i = 0; i <= ph->h1->mask; i++) for (unsigned i = 0; i <= ph->h1->mask; i++)
if (vbit_test(ph->collision, i)) { if (vbit_test(ph->collision, i)) {
struct hash *h2; struct hash *h2;
uint64_t sz;
h2 = ph->tbl[i].h2; h2 = ph->tbl[i].h2;
CHECK_OBJ_NOTNULL(h2, HASH_MAGIC); CHECK_OBJ_NOTNULL(h2, HASH_MAGIC);
sz = h2->mask + 1;
stats->collisions++; stats->collisions++;
if (sz < stats->h2buckets_min)
stats->h2buckets_min = sz;
if (sz > stats->h2buckets_max)
stats->h2buckets_max = sz;
stats->h2buckets_avg +=
(sz - stats->h2buckets_avg)
/ stats->collisions;
} }
} }
......
...@@ -50,6 +50,9 @@ struct ph_stats { ...@@ -50,6 +50,9 @@ struct ph_stats {
uint64_t klen; uint64_t klen;
uint64_t minlen; uint64_t minlen;
uint64_t maxlen; uint64_t maxlen;
uint64_t h2buckets_min;
uint64_t h2buckets_max;
double h2buckets_avg;
}; };
/* /*
......
...@@ -329,6 +329,9 @@ main(int argc, char *argv[]) ...@@ -329,6 +329,9 @@ main(int argc, char *argv[])
printf("%lu key vector length\n", stats.klen); printf("%lu key vector length\n", stats.klen);
printf("%lu min string length\n", stats.minlen); printf("%lu min string length\n", stats.minlen);
printf("%lu max string length\n", stats.maxlen); printf("%lu max string length\n", stats.maxlen);
printf("%lu h2 min buckets\n", stats.h2buckets_min);
printf("%lu h2 max buckets\n", stats.h2buckets_max);
printf("%.1f h2 mean buckets\n", stats.h2buckets_avg);
if (do_iters == 0) if (do_iters == 0)
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
......
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