From a9f5259f080a1c114a6de06f2ec67730e4e50f13 Mon Sep 17 00:00:00 2001 From: jason Date: Wed, 7 Apr 2010 15:54:29 +0000 Subject: [PATCH] * pt.c (print_template_statistics): New. * cp-tree.h: Declare it. * tree.c (cxx_print_statistics): Call it. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158072 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 4 ++++ gcc/cp/cp-tree.h | 1 + gcc/cp/pt.c | 15 +++++++++++++++ gcc/cp/tree.c | 1 + 4 files changed, 21 insertions(+) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index a6e6f3a85e8..d3b0788218d 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2010-04-07 Jason Merrill + * pt.c (print_template_statistics): New. + * cp-tree.h: Declare it. + * tree.c (cxx_print_statistics): Call it. + PR c++/41970 * decl.c (grokvardecl): Tweak warning message. (grokfndecl): Likewise. diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 63346736cf6..1350619057a 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -4975,6 +4975,7 @@ extern void pop_tinst_level (void); extern struct tinst_level *outermost_tinst_level(void); extern bool parameter_of_template_p (tree, tree); extern void init_template_processing (void); +extern void print_template_statistics (void); bool template_template_parameter_p (const_tree); extern bool primary_template_instantiation_p (const_tree); extern tree get_primary_template_innermost_parameters (const_tree); diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 13bb5aadf4d..d1c33d65277 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -18554,4 +18554,19 @@ init_template_processing (void) ggc_free); } +/* Print stats about the template hash tables for -fstats. */ + +void +print_template_statistics (void) +{ + fprintf (stderr, "decl_specializations: size %ld, %ld elements, " + "%f collisions\n", (long) htab_size (decl_specializations), + (long) htab_elements (decl_specializations), + htab_collisions (decl_specializations)); + fprintf (stderr, "type_specializations: size %ld, %ld elements, " + "%f collisions\n", (long) htab_size (type_specializations), + (long) htab_elements (type_specializations), + htab_collisions (type_specializations)); +} + #include "gt-cp-pt.h" diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 35b0da62ea5..27ced53a2b4 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -1664,6 +1664,7 @@ cxx_print_statistics (void) { print_search_statistics (); print_class_statistics (); + print_template_statistics (); #ifdef GATHER_STATISTICS fprintf (stderr, "maximum template instantiation depth reached: %d\n", depth_reached); -- 2.11.4.GIT