bed8e79f1742da6358f6239946fec3d2efde788d
markd
  Sun Mar 6 22:45:46 2011 -0800
added method to print out stats for hash usage
diff --git src/inc/hash.h src/inc/hash.h
index 80207ea..93bb311 100644
--- src/inc/hash.h
+++ src/inc/hash.h
@@ -61,30 +61,31 @@
     void *val;
     bits32 hashVal;
     };
 
 struct hash
     {
     struct hash *next;	/* Next in list. */
     bits32 mask;	/* Mask hashCrc with this to get it to fit table. */
     struct hashEl **table;	/* Hash buckets. */
     int powerOfTwoSize;		/* Size of table as a power of two. */
     int size;			/* Size of table. */
     struct lm *lm;	/* Local memory pool. */
     int elCount;		/* Count of elements. */
     boolean autoExpand;         /* Automatically expand hash */
     float expansionFactor;      /* Expand when elCount > size*expansionFactor */
+    int numResizes;             /* number of times resize was called */
     };
 
 #define defaultExpansionFactor 1.0
 
 #define hashMaxSize 28 
 
 struct hashCookie
 /* used by hashFirst/hashNext in tracking location in traversing hash */
     {
     struct hash *hash;      /* hash we are associated with */
     int idx;                /* current index in hash */
     struct hashEl *nextEl;  /* current element in hash */
     };
 
 bits32 hashString(char *string);
@@ -238,30 +239,33 @@
 void freeHashAndVals(struct hash **pHash);
 /* Free up hash table and all values associated with it.
  * (Just calls freeMem on each hel->val) */
 
 void hashFreeWithVals(struct hash **pHash, void (freeFunc)());
 /* Free up hash table and all values associated with it. freeFunc is a
  * function to free an entry, should take a pointer to a pointer to an
  * entry. */
 
 void hashFreeList(struct hash **pList);
 /* Free up a list of hashes. */
 
 void hashHisto(struct hash *hash, char *fname);
 /* Output bucket usage counts to a file for producing a histogram  */
 
+void hashPrintStats(struct hash *hash, char *label, FILE *fh);
+/* print statistic about a hash table */
+
 struct hashEl *hashReplace(struct hash *hash, char *name, void *val);
 /* Replace an existing element in hash table, or add it if not present. */
 
 boolean hashMayRemove(struct hash *hash, char *name);
 /* Remove item of the given name from hash table, if present.
  * Return true if it was present */
 
 void hashMustRemove(struct hash *hash, char *name);
 /* Remove item of the given name from hash table, or error
  * if not present */
 
 char *hashToRaString(struct hash *hash);
 /* Convert hash to string in ra format. */
 
 int hashNumEntries(struct hash *hash);