WTF
Go to the documentation of this file.
20 #include <config-kjs.h>
25 #if DUMP_HASHTABLE_STATS
27 int HashTableStats::numAccesses;
28 int HashTableStats::numCollisions;
29 int HashTableStats::collisionGraph[4096];
30 int HashTableStats::maxCollisions;
31 int HashTableStats::numRehashes;
32 int HashTableStats::numRemoves;
33 int HashTableStats::numReinserts;
35 static HashTableStats logger;
37 HashTableStats::~HashTableStats()
39 printf(
"\nkhtml::HashTable statistics\n\n");
40 printf(
"%d accesses\n", numAccesses);
41 printf(
"%d total collisions, average %.2f probes per access\n", numCollisions, 1.0 * (numAccesses + numCollisions) / numAccesses);
42 printf(
"longest collision chain: %d\n", maxCollisions);
43 for (
int i = 1; i <= maxCollisions; i++) {
44 printf(
" %d lookups with exactly %d collisions (%.2f%% , %.2f%% with this many or more)\n", collisionGraph[i], i, 100.0 * (collisionGraph[i] - collisionGraph[i+1]) / numAccesses, 100.0 * collisionGraph[i] / numAccesses);
46 printf(
"%d rehashes\n", numRehashes);
47 printf(
"%d reinserts\n", numReinserts);
50 void HashTableStats::recordCollisionAtCount(
int count)
52 if (count > maxCollisions)
53 maxCollisions = count;
55 collisionGraph[count]++;
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:23:46 by
doxygen 1.8.7 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.