public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <law@redhat.com>
To: "Martin Liška" <mliska@suse.cz>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH, RFC] New memory usage statistics infrastructure
Date: Tue, 19 May 2015 07:25:00 -0000	[thread overview]
Message-ID: <555AE384.5000004@redhat.com> (raw)
In-Reply-To: <555604F0.40802@suse.cz>

On 05/15/2015 08:38 AM, Martin Liška wrote:
> Hello.
>
> Following patch attempts to rewrite memory reports for GCC's internal
> allocations
> so that it uses a new template type. The type shares parts which are
> currently duplicated,
> adds support for special 'counters' and introduces new support for
> hash-{set,map,table}.
>
> Transformation of the current code is a bit tricky as we internally used
> hash-table as main
> data structure which takes care of location-related allocations. As I
> want to add support even
> for hash tables (and all derived types), header files inclusion and
> forward declaration is utilized.
>
> Feel free to comment the patch, as well as missing features one may want
> to track by location sensitive
> memory allocation.
>
> Attachment contains sample output taken from tramp3d-v4.cpp.
>
> Thanks,
> Martin
>

> 0001-New-memory-allocation-statistics-infrastructure.patch
>
>
>  From 7a9048ef36bddf17209acadc1dcab9fc48a7fd63 Mon Sep 17 00:00:00 2001
> From: mliska<mliska@suse.cz>
> Date: Tue, 5 May 2015 11:34:16 +0200
> Subject: [PATCH] New memory allocation statistics infrastructure.
>
> gcc/ChangeLog:
>
> 2015-05-05  Martin Liska<mliska@suse.cz>
>
> 	* Makefile.in: Add additional dependencies related to memory report
> 	enhancement.
> 	* alloc-pool.c (allocate_pool_descriptor): Use new ctor.
> 	* bitmap.c (struct bitmap_descriptor_d): Remove.
> 	(struct loc): Likewise.
> 	(struct bitmap_desc_hasher): Likewise.
> 	(bitmap_desc_hasher::hash): Likewise.
> 	(bitmap_desc_hasher::equal): Likewise.
> 	(get_bitmap_descriptor): Likewise.
> 	(bitmap_register): User new memory descriptor API.
> 	(register_overhead): Likewise.
> 	(bitmap_find_bit): Register nsearches and search_iter statistics.
> 	(struct bitmap_output_info): Remove.
> 	(print_statistics): Likewise.
> 	(dump_bitmap_statistics): Use new memory descriptor.
> 	* bitmap.h (struct bitmap_usage): New class.
> 	* genmatch.c: Extend header file inclusion.
> 	* genpreds.c: Likewise.
> 	* ggc-common.c (struct ggc_usage): New class.
> 	(struct ggc_loc_desc_hasher): Remove.
> 	(ggc_loc_desc_hasher::hash): Likewise.
> 	(ggc_loc_desc_hasher::equal): Likewise.
> 	(struct ggc_ptr_hash_entry): Likewise.
> 	(struct ptr_hash_hasher): Likewise.
> 	(ptr_hash_hasher::hash): Likewise.
> 	(ptr_hash_hasher::equal): Likewise.
> 	(make_loc_descriptor): Likewise.
> 	(ggc_prune_ptr): Likewise.
> 	(dump_ggc_loc_statistics): Use new memory descriptor.
> 	(ggc_record_overhead): Likewise.
> 	(ggc_free_overhead): Likewise.
> 	(final_cmp_statistic): Remove.
> 	(cmp_statistic): Likewise.
> 	(ggc_add_statistics): Liekwise.
> 	(ggc_prune_overhead_list): Likewise.
> 	* hash-map-traits.h: New file.
> 	* hash-map.h (struct default_hashmap_traits): Move the traits to a
> 	separate header file.
> 	* hash-set.h: Pass memory statistics info to ctor.
> 	* hash-table.c (void dump_hash_table_loc_statistics): New function.
> 	* hash-table.h (hash_table::hash_table): Add new ctor arguments.
> 	(hash_table::~hash_table): Register memory release operation.
> 	(hash_table::alloc_entries): Handle memory allocation operation.
> 	(hash_table::expand): Likewise.
> 	* inchash.c (iterative_hash_hashval_t): Move implementation to header
> 	file.
> 	(iterative_hash_host_wide_int): Likewise.
> 	* inchash.h (class hash): Likewise.
> 	* mem-stats-traits.h: New file.
> 	* mem-stats.h: New file.
> 	(mem_location): Add new class.
> 	(mem_usage): Likewise.
> 	(mem_alloc_description): Likewise.
> 	* sese.c: Add new header file inclusision.
> 	* toplev.c (dump_memory_report): Add report for hash_table, hash_map
> 	and hash_set.
> 	* tree-sra.c: Add new header file inclusision.
> 	* vec.c (struct vec_descriptor): Remove.
> 	(hash_descriptor): Likewise.
> 	(struct vec_usage): Likewise.
> 	(struct ptr_hash_entry): Likewise.
> 	(hash_ptr): Likewise.
> 	(eq_ptr): Likewise.
> 	(vec_prefix::register_overhead): Use new memory descriptor API.
> 	(vec_prefix::release_overhead): Likewise.
> 	(add_statistics): Remove.
> 	(dump_vec_loc_statistics): Use new memory descriptor API.
> 	* vec.h (struct vec_prefix): Likewise.
> 	(va_heap::reserve): Likewise.
> 	(va_heap::release): Likewise.
Please check for overly-long lines.  I spotted several, but didn't keep 
them handy as I was working through the patch.  ISTM that using the 
script from contrib/ might help identify the overly long lines.

Overall it looks good -- I like the consistency in reporting.  I think 
if there's things missing, we ought to be able to add them incrementally.

My recommendation would be to take care of the line wrapping issues, run 
it through the usual bootstrap and testing cycles and commit assuming 
nothing is amiss.

jeff

  parent reply	other threads:[~2015-05-19  7:17 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-15 14:44 Martin Liška
2015-05-15 14:53 ` Martin Liška
2015-05-19  7:25 ` Jeff Law [this message]
2015-05-28 11:39 ` Thomas Schwinge
2015-05-28 12:34   ` Martin Liška
2015-05-28 17:57     ` Jeff Law
2016-01-29 16:24       ` Patrick Palka
2016-02-01 13:57         ` Martin Liška
2015-05-29 16:54 ` Vidya Praveen
2015-06-01 11:38   ` Martin Liška
2015-06-01 12:18     ` Richard Biener
2015-06-01 14:08       ` Martin Liška
2015-06-01 14:22         ` Vidya Praveen
2015-06-01 16:35           ` Vidya Praveen
2015-06-01 15:36         ` Martin Liška

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=555AE384.5000004@redhat.com \
    --to=law@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=mliska@suse.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).