From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4258 invoked by alias); 27 Mar 2015 15:26:10 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 4247 invoked by uid 89); 27 Mar 2015 15:26:10 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: nikam.ms.mff.cuni.cz Received: from nikam.ms.mff.cuni.cz (HELO nikam.ms.mff.cuni.cz) (195.113.20.16) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 27 Mar 2015 15:26:09 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id A3BDC546B46; Fri, 27 Mar 2015 16:26:06 +0100 (CET) Date: Fri, 27 Mar 2015 15:26:00 -0000 From: Jan Hubicka To: gcc-patches@gcc.gnu.org Subject: Fix detailed mem report WRT hash tables Message-ID: <20150327152606.GE63825@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-SW-Source: 2015-03/txt/msg01448.txt.bz2 Hi, I notieced that GGC hash tables are now accounted to hash-table.h:alloc_entries that is not very informative (we do not have any stats for heap hash tables that would be nice to have). This patch fixes the first problem by adding annotations. OK (perhaps for next stage1?) Bootstrapped/regtested x86_64-linux with and without gathering stats. Honza * hash-table.c (hash_table constructor): Add mem stats. (alloc_entries): Likewise. Index: hash-table.h =================================================================== --- hash-table.h (revision 221734) +++ hash-table.h (working copy) @@ -615,7 +615,7 @@ class hash_table class Allocator> -hash_table::hash_table (size_t size) : +hash_table::hash_table (size_t size + MEM_STAT_DECL) : m_n_elements (0), m_n_deleted (0), m_searches (0), m_collisions (0) { unsigned int size_prime_index; @@ -1116,7 +1117,7 @@ class hash_table friend void gt_pch_nx (hash_table *, gt_pointer_operator, void *); - value_type *alloc_entries (size_t n) const; + value_type *alloc_entries (size_t n CXX_MEM_STAT_INFO) const; value_type *find_empty_slot_for_expand (hashval_t); void expand (); static bool is_deleted (value_type &v) @@ -1295,7 +1296,8 @@ private: }; template class Allocator> -hash_table::hash_table (size_t size, bool ggc) : +hash_table::hash_table (size_t size, bool ggc + MEM_STAT_DECL) : m_n_elements (0), m_n_deleted (0), m_searches (0), m_collisions (0), m_ggc (ggc) { @@ -1304,7 +1306,7 @@ hash_table: size_prime_index = hash_table_higher_prime_index (size); size = prime_tab[size_prime_index].prime; - m_entries = alloc_entries (size); + m_entries = alloc_entries (size PASS_MEM_STAT); m_size = size; m_size_prime_index = size_prime_index; } @@ -1326,14 +1328,15 @@ hash_table: template class Allocator> inline typename hash_table::value_type * -hash_table::alloc_entries (size_t n) const +hash_table::alloc_entries + (size_t n MEM_STAT_DECL) const { value_type *nentries; if (!m_ggc) nentries = Allocator ::data_alloc (n); else - nentries = ::ggc_cleared_vec_alloc (n); + nentries = ::ggc_cleared_vec_alloc (n PASS_MEM_STAT); gcc_assert (nentries != NULL); for (size_t i = 0; i < n; i++)