]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
pt.c (print_template_statistics): New.
authorJason Merrill <jason@redhat.com>
Wed, 7 Apr 2010 15:54:29 +0000 (11:54 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 7 Apr 2010 15:54:29 +0000 (11:54 -0400)
* pt.c (print_template_statistics): New.
* cp-tree.h: Declare it.
* tree.c (cxx_print_statistics): Call it.

From-SVN: r158072

gcc/cp/ChangeLog
gcc/cp/cp-tree.h
gcc/cp/pt.c
gcc/cp/tree.c

index a6e6f3a85e8dfb11b6e2a59dd393c5c0c260a4ab..d3b0788218d398e059fc0fca5d25cff2d5310316 100644 (file)
@@ -1,5 +1,9 @@
 2010-04-07  Jason Merrill  <jason@redhat.com>
 
+       * 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.
index 63346736cf6ab8300a3e1116741546b249c50c06..1350619057aae79ebb52d30878cfe6c703cfa46c 100644 (file)
@@ -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);
index 13bb5aadf4d185bf74781d7e07217b7b15560567..d1c33d65277251e353dac094e3d04e4aaf975147 100644 (file)
@@ -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"
index 35b0da62ea5b8ec4c2d1738088cff9f04a152756..27ced53a2b4495f40e3f8993a09404f3781ff89c 100644 (file)
@@ -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);