TutHashDump


Name

TutHashDump — dump the information about a hash table

Synopsis

void TutHashDump(table, output_func) 
T_HASH_TABLE table; 
T_OUT_FUNC output_func;  

Arguments

table — table to be dumped

output_func — function used to print the data

Return Values

None

Diagnostics

None

Description

TutHashDump prints statistical information about the specified hash table, such as size, number of entries, maximum number of entries, number of collisions, and some bucket statistics. It takes two arguments as input. table is a hash table to be dumped. output_func is an output function that is used to print the hash table information. The output function should accept arguments in the same format as a printf statement. If output_func is NULL, an internal function is used that sends the data to stderr.

Caution

None

See Also

None

Examples

This example creates a hash table, inserts two entries, then dumps the table:

int main() 
{ 
  T_HASH_TABLE table; 
 
  table = TutHashCreateStri(4); 
  TutHashInsert(table, "hi", (T_PTR)1); 
  TutHashInsert(table, "there", (T_PTR)2); 
  TutHashDump(table, TutOut); 
  TutExit(T_EXIT_SUCCESS); 
} 

This is a sample of the output:

*** Dumping Hash Table *** 
 Size = 8, Num Entries = 2, Max Entries = 6, Collisions = 0 
 All Buckets: Avg Size = 0.250000, Std Dev = 1.224745 
 Non-Empty Buckets (2): Avg Size = 1.000000, Std Dev = 1.224745 
 Bucket 0 has 0 entries 
 Bucket 1 has 1 entries 
 hi 1 
 Bucket 2 has 0 entries 
 Bucket 3 has 0 entries 
 Bucket 4 has 1 entries 
 there 2 
 Bucket 5 has 0 entries 
 Bucket 6 has 0 entries 
 Bucket 7 has 0 entries 

TIBCO SmartSockets™ Utilities
Software Release 6.8, July 2006
Copyright © TIBCO Software Inc. All rights reserved
www.tibco.com