From: Richard Biener <richard.guenther@gmail.com>
To: Jan Hubicka <hubicka@ucw.cz>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: Fix detailed mem report WRT hash tables
Date: Mon, 30 Mar 2015 09:13:00 -0000 [thread overview]
Message-ID: <CAFiYyc3WOfju7A0pwo2tKm4fngYVAY1sh+HB0odkKFKYQZZqaQ@mail.gmail.com> (raw)
In-Reply-To: <20150327152606.GE63825@kam.mff.cuni.cz>
On Fri, Mar 27, 2015 at 4:26 PM, Jan Hubicka <hubicka@ucw.cz> wrote:
> 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?)
Ok for stage1.
Thanks,
Richard.
> 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<Descriptor, Allocator,
> typedef typename Descriptor::compare_type compare_type;
>
> public:
> - hash_table (size_t);
> + hash_table (size_t CXX_MEM_STAT_INFO);
> ~hash_table ();
>
> /* Current size (in entries) of the hash table. */
> @@ -751,7 +751,8 @@ private:
> };
>
> template<typename Descriptor, template<typename Type> class Allocator>
> -hash_table<Descriptor, Allocator, false>::hash_table (size_t size) :
> +hash_table<Descriptor, Allocator, false>::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<Descriptor, Allocator,
> typedef typename Descriptor::compare_type compare_type;
>
> public:
> - explicit hash_table (size_t, bool ggc = false);
> + explicit hash_table (size_t, bool ggc = false CXX_MEM_STAT_INFO);
> ~hash_table ();
>
> /* Create a hash_table in gc memory. */
> @@ -1245,7 +1246,7 @@ private:
> template<typename T> friend void gt_pch_nx (hash_table<T> *,
> 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<typename Descriptor, template<typename Type> class Allocator>
> -hash_table<Descriptor, Allocator, true>::hash_table (size_t size, bool ggc) :
> +hash_table<Descriptor, Allocator, true>::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<Descriptor, Allocator, true>:
> 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<Descriptor, Allocator, true>:
>
> template<typename Descriptor, template<typename Type> class Allocator>
> inline typename hash_table<Descriptor, Allocator, true>::value_type *
> -hash_table<Descriptor, Allocator, true>::alloc_entries (size_t n) const
> +hash_table<Descriptor, Allocator, true>::alloc_entries
> + (size_t n MEM_STAT_DECL) const
> {
> value_type *nentries;
>
> if (!m_ggc)
> nentries = Allocator <value_type> ::data_alloc (n);
> else
> - nentries = ::ggc_cleared_vec_alloc<value_type> (n);
> + nentries = ::ggc_cleared_vec_alloc<value_type> (n PASS_MEM_STAT);
>
> gcc_assert (nentries != NULL);
> for (size_t i = 0; i < n; i++)
next prev parent reply other threads:[~2015-03-30 9:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-27 15:26 Jan Hubicka
2015-03-30 9:13 ` Richard Biener [this message]
2015-04-13 13:35 ` Jeff Law
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAFiYyc3WOfju7A0pwo2tKm4fngYVAY1sh+HB0odkKFKYQZZqaQ@mail.gmail.com \
--to=richard.guenther@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=hubicka@ucw.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).