Dump stats about hottest hash tables when -fmem-report

Dimitrios Apostolou jimis@gmx.net
Tue Aug 9 08:07:00 GMT 2011


Hello list,

this is the second part of my patch. It collects and prints some memory 
statistics for hash tables that I've measured as the hottest ones. Tested 
together with previous patch on i386. Example output:


libcpp symtab string pool:
         identifiers     32644 (100.00%)
         entries         32644 (49.81%)
         deleted         0
         slots           65536
         string bytes    445k (4064  obstack_memory_used)
         table size      256k
         searches        234217
         collisions      86838
         coll/search     0.3708
         ins/search      0.1394
         avg. entry      13.97 bytes (+/- 6.42)
         longest entry   52
No gimple statistics

??? tree nodes created

(No per-node statistics)
DECL_DEBUG_EXPR  hash: size 1021, 23 elements, 0.000000 collisions
DECL_VALUE_EXPR  hash: size 1021, 0 elements, 0.000000 collisions

tree.c:type_hash_table stats
         slots           32749
         identifiers     5605
         entries         5605 (17.12%)
         deleted         0
         struct htab     60  B
         table size      127 kB
         element         8  B
         total contents  43 kB
         searches        27032
         collisions      9148
         coll/search     0.3384

emit-rtl.c:mem_attrs_htab hash table:
         slots           8191
         identifiers     2295
         entries         2295 (28.02%)
         deleted         0
         struct htab     60  B
         table size      31 kB
         element         24  B
         total contents  53 kB
         searches        7166
         collisions      3784
         coll/search     0.5280

cgraph.c:cgraph_hash hash table stats:
         slots           8191
         identifiers     198
         entries         3100 (37.85%)
         deleted         2902
         struct htab     60  B
         table size      31 kB
         element         160  B
         total contents  30 kB
         searches        103425
         collisions      32761
         coll/search     0.3168

var-tracking.c stats
         2363 vars->htab hash tables:
                 total searches          483055
                 total collisions        68621
                 total coll/search       0.1421
         54 changed_variables hash tables
                 total searches          33417
                 total collisions        14253
                 total coll/search       0.4265
         54 value_chains hash tables
                 total searches          43924
                 total collisions        14027
                 total coll/search       0.3193

cselib stats for 614 hash tables
         total searches          52840
         total collisions        9597
         total coll/search       0.1816



Changelog:

2011-08-09  Dimitrios Apostolou  <jimis@gmx.net>

 	* cgraph.c, cgraph.h (cgraph_dump_stats): New function to dump
 	stats about cgraph_hash hash table.
 	* cselib.c, cselib.h (cselib_dump_stats): New function to dump
 	stats about cselib_hash_table.
 	* cselib.c (cselib_finish): Keep statistics by increasing values
 	of new global variables cselib_htab_{num,searches,collisions} if
 	-fmem-report.
 	* emit-rtl.c, emit-rtl.h (mem_attrs_dump_stats): New function to
 	dump statistics about mem_attrs_htab hash table.
 	* tree.c (print_type_hash_statistics): Used the new
 	htab_dump_statistics() function.
 	* var-tracking.c (shared_hash_destroy): Keep statistics by
 	increasing values of new global variables
 	vars_htab_{num,searches,collisions} if -fmem-report.
 	(vt_finalize): Keep statistics by increasing values of new global
 	variables cv_htab_{num,searches,collisions} and
 	vc_htab_{num,searches,collisions} if -fmem-report.
 	* var-tracking.c, rtl.h (vt_dump_stats): New function to dump
 	stats about vars->htab, changed_variables and value_chains hash
 	tables.
 	* toplev.c: Included cselib.h for cselib_dump_stats().
 	(dump_memory_report): Call all the above functions to provide
 	better statistics.
 	* hashtab.c, hashtab.h (htab_dump_statistics, htab_collisions_num)
 	(htab_searches_num): New functions for statistics.
 	* hashtab.c: Included assert.h for checks in htab_dump_statistics.
 	* symtab.c (ht_dump_statistics): Beautified stats output.


Thanks,
Dimitris
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: gcc-ht-size-2.diff
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20110809/579cb443/attachment.ksh>


More information about the Gcc-patches mailing list