public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: David Malcolm <dmalcolm@redhat.com>
To: Thomas Schwinge <thomas@codesourcery.com>, gcc-patches@gcc.gnu.org
Cc: Jan Hubicka <hubicka@ucw.cz>
Subject: Re: Better memory statistics, take 2
Date: Tue, 17 Aug 2021 09:27:46 -0400	[thread overview]
Message-ID: <18b3c7c76c6d29057f91cbc8997e5161c3b4c953.camel@redhat.com> (raw)
In-Reply-To: <874kboh1l8.fsf@euler.schwinge.homeip.net>

On Tue, 2021-08-17 at 11:17 +0200, Thomas Schwinge wrote:
> Hi!
> 
> On 2004-09-02T18:47:01+0200, Jan Hubicka <hubicka@ucw.cz> wrote:
> > *** ggc-common.c      9 Aug 2004 20:19:29 -0000       1.88
> > --- ggc-common.c      2 Sep 2004 16:08:50 -0000
> 
> > + /* When set, ggc_collect will do collection.  */
> > + bool ggc_force_collect;
> 
> > *************** void dump_ggc_loc_statistics (void)
> 
> > +   ggc_force_collect = true;
> > +   ggc_collect ();
> 
> > *************** ggc_collect (void)
> 
> > !   if (G.allocated < allocated_last_gc + min_expand)
> 
> > !   if (G.allocated < allocated_last_gc + min_expand &&
> > !ggc_force_collect)
> 
> > *** ggc.h     2 Sep 2004 02:39:15 -0000       1.68
> > --- ggc.h     2 Sep 2004 16:08:50 -0000
> 
> > + /* When set, ggc_collect will do collection.  */
> > + extern bool ggc_force_collect;
> 
> This has later acquired another use in the GCC selftests.
> 
> I wonder if we shouldn't simplify the interface per the attached
> "Turn
> global 'ggc_force_collect' variable into 'force_collect' parameter to
> 'ggc_collect'"?  OK to push to master branch after bootstrap testing?

Looks good to me, but bool params can be unclear - maybe introduce an
enum to make the meaning more explicit to the reader of the code?

e.g.

enum gcc_collect_when
{
  GGC_COLLECT_UNDER_MEMORY_PRESSURE,
  GGC_COLLECT_ALWAYS
};

or somesuch???

Dave



  parent reply	other threads:[~2021-08-17 13:27 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-05 18:25 Make per-call statistics to take into account ggc_free Jan Hubicka
2004-03-19  8:14 ` Jan Hubicka
2004-09-02 16:12 ` Better memory statistics, take 2 Jan Hubicka
2004-09-02 16:27   ` Zack Weinberg
2004-09-02 16:45     ` Matt Austern
2004-09-02 16:47       ` Jan Hubicka
2004-09-02 17:15         ` Zack Weinberg
2004-09-02 17:23           ` Jan Hubicka
2004-09-02 17:28     ` Daniel Jacobowitz
2004-09-02 16:54   ` Jan Hubicka
2004-09-02 17:18     ` Richard Henderson
2021-08-17  9:17     ` Thomas Schwinge
2021-08-17 10:21       ` Richard Biener
2021-08-17 13:27       ` David Malcolm [this message]
2021-08-17 19:31         ` Thomas Schwinge
2021-08-18  7:02           ` Richard Biener

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=18b3c7c76c6d29057f91cbc8997e5161c3b4c953.camel@redhat.com \
    --to=dmalcolm@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hubicka@ucw.cz \
    --cc=thomas@codesourcery.com \
    /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).