This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GC special object sizes


Dan Nicolaescu <dann@ics.uci.edu> writes:

> Zack Weinberg <zack@codesourcery.com> writes:
>
>   > Dan Nicolaescu <dann@ics.uci.edu> writes:
>   > 
>   > > I have a small hack that prints the allocation overheads for the
>   > > different bucket sizes when using -fmem-report. The *_under* stuff can
>   > > be used to determine if any extra buckets need to be added to
>   > > extra_order_size_table.
>   > >
>   > > Is this useful? Should it be turned in a proper patch? If yes, it
>   > > should probably not be compiled in by default. What switch should be
>   > > used to control that? Any other suggestions? 
>   > 
>   > Yes, I think this is useful.  I would suggest that you look into the
>   > GATHER_STATISTICS #define, which has not done anything useful for years
>   > but could be made useful once again.  Or, see if you can get the
>   > statistics-gathering overhead down to the point that it can be a
>   > runtime option (-fmem-stats=verbose or something like that).
>
> IMO the overhead that the stats collection adds is not justified, so I
> putting the code under #ifdef GATHER_STATISTICS.  

OK, fair enough.

> GATHER_STATISTICS works, it just misses a configure flag to enable
> it. I'll leave fixing that to somebody that knows autoconf better.

I can look into that.

> Total Overhead order     3:                 1636
> Total Overhead order     5:               662776
> Total Overhead order     6:               609388
> Total Overhead order     7:                69732
> Total Overhead order     8:              1943690
> Total Overhead order     9:              2628608
> Total Overhead order    10:              5666732
> Total Overhead order    11:              1295564
> Total Overhead order    12:              2408564
> Total Overhead order    13:              2872164
> Total Overhead order    14:              3535928
> Total Overhead order    15:              3452452
> Total Overhead order    16:              1143768
> Total Overhead order    17:               347984
> Total Overhead order    18:                   60
> Total Overhead order    32:              2635568
> Total Overhead order    36:              5229832

Order numbers are not terribly useful - could you make this print the
allocation size of the order, instead?

> 	* tree.c (enum tree_node_kind): Add comment about updating.
>
> 	* ggc-page.c (TOTAL_ALLOCATED, TOTAL_OVERHEAD,
> 	TOTAL_ALLOCATED_under32, TOTAL_OVERHEAD_under32,
> 	TOTAL_ALLOCATED_under64, TOTAL_OVERHEAD_under64,
> 	TOTAL_ALLOCATED_under128, TOTAL_OVERHEAD_under128): New static
> 	variables.
> 	(ggc_print_statistics): Print them.
> 	(ggc_alloc): Keep track of the total allocated memory and the
> 	overhead.

Stylistically speaking, I think these static variables ought to be
part of the G structure, and perhaps they ought to be nested into a
structure of their own:

static struct {
  ...
#ifdef GATHER_STATISTICS
  struct {
    ...
  } stats;
#endif
} G;

like that.  Also please don't use CAPITAL LETTERS so much.

> 	* lex.c (enum tree_node_kind): Synchronize with toplevel tree.c. 

Suggest you hoist enum tree_node_kind to tree.h, and define it
unconditionally; then we don't have multiple copies that can get out
of sync.

zw


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]