From 7d05c217fdd98f22d4d07e300b695073a98b6a73 Mon Sep 17 00:00:00 2001 From: marxin Date: Mon, 5 Nov 2018 13:35:09 +0000 Subject: [PATCH] Fix string pool statistics. 2018-11-05 Martin Liska * symtab.c (ht_dump_statistics): Make dump conditional based on alloc_subobject. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@265797 138bc75d-0d04-0410-961f-82ee72b054a4 --- libcpp/ChangeLog | 5 +++++ libcpp/symtab.c | 14 ++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index d9eaa04d427..36ee636bf9c 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,8 @@ +2018-11-05 Martin Liska + + * symtab.c (ht_dump_statistics): Make dump conditional + based on alloc_subobject. + 2018-10-31 Joseph Myers PR bootstrap/82856 diff --git a/libcpp/symtab.c b/libcpp/symtab.c index fd86c849f7f..e6e5bcb1cef 100644 --- a/libcpp/symtab.c +++ b/libcpp/symtab.c @@ -304,7 +304,6 @@ ht_dump_statistics (cpp_hash_table *table) while (++p < limit); nelts = table->nelements; - overhead = obstack_memory_used (&table->stack) - total_bytes; headers = table->nslots * sizeof (hashnode); fprintf (stderr, "\nString pool\nentries\t\t%lu\n", @@ -315,9 +314,16 @@ ht_dump_statistics (cpp_hash_table *table) (unsigned long) table->nslots); fprintf (stderr, "deleted\t\t%lu\n", (unsigned long) deleted); - fprintf (stderr, "bytes\t\t%lu%c (%lu%c overhead)\n", - SCALE (total_bytes), LABEL (total_bytes), - SCALE (overhead), LABEL (overhead)); + + if (table->alloc_subobject) + fprintf (stderr, "GGC bytes\t%lu%c\n", + SCALE (total_bytes), LABEL (total_bytes)); + else + { + overhead = obstack_memory_used (&table->stack) - total_bytes; + fprintf (stderr, "obstack bytes\t%lu%c (%lu%c overhead)\n", + SCALE (total_bytes), LABEL (total_bytes)); + } fprintf (stderr, "table size\t%lu%c\n", SCALE (headers), LABEL (headers)); -- 2.11.4.GIT