ncno += cno_occurences[i];
}
VG_(message)(Vg_DebugMsg,
- "total nr of unique chains: %6d, keys %6d, elts %6d\n",
- ncno, nkey, nelt);
+ "total nr of unique slots: %6d, keys %6d, elts %6d."
+ " Avg chain len %3.1f\n",
+ ncno, nkey, nelt,
+ (Double)nelt/(Double)(ncno == cno_occurences[0] ?
+ 1 : ncno - cno_occurences[0]));
}
*fixp = (Word)i;
return;
}
- }
+ }
- /*NOTREACHED*/
- tl_assert(0);
+ /*NOTREACHED*/
+ tl_assert(0);
}
(UWord)N_RCEC_TAB,
stats__ctxt_tab_curr, RCEC_referenced,
stats__ctxt_tab_max );
+ {
+# define MAXCHAIN 10
+ UInt chains[MAXCHAIN+1]; // [MAXCHAIN] gets all chains >= MAXCHAIN
+ UInt non0chain = 0;
+ UInt n;
+ UInt i;
+ RCEC *p;
+
+ for (i = 0; i <= MAXCHAIN; i++) chains[i] = 0;
+ for (i = 0; i < N_RCEC_TAB; i++) {
+ n = 0;
+ for (p = contextTab[i]; p; p = p->next)
+ n++;
+ if (n < MAXCHAIN)
+ chains[n]++;
+ else
+ chains[MAXCHAIN]++;
+ if (n > 0)
+ non0chain++;
+ }
+ VG_(printf)( " libhb: contextTab chain of [length]=nchain."
+ " Avg chain len %3.1f\n"
+ " ",
+ (Double)stats__ctxt_tab_curr
+ / (Double)(non0chain ? non0chain : 1));
+ for (i = 0; i <= MAXCHAIN; i++) {
+ if (chains[i] != 0)
+ VG_(printf)( "[%d%s]=%d ",
+ i, i == MAXCHAIN ? "+" : "",
+ chains[i]);
+ }
+ VG_(printf)( "\n");
+# undef MAXCHAIN
+ }
VG_(printf)( " libhb: contextTab: %lu queries, %lu cmps\n",
stats__ctxt_tab_qs,
stats__ctxt_tab_cmps );