[PATCH 5/7] Add line map statistics to -fmem-report output

Jason Merrill jason@redhat.com
Mon Sep 12 22:07:00 GMT 2011


On 07/16/2011 10:37 AM, Dodji Seketeli wrote:
> +#define ONE_M ONE_K * ONE_K

Parenthesize this so that users don't need to.

> +  macro_maps_used_size =
> +    LINEMAPS_MACRO_USED (set) * sizeof (struct line_map)
> +    + macro_maps_locations_size;

It seems odd to add in the locations size here since it's also printed 
separately.

> +  fprintf (stderr, "Total allocated maps size:           %5lu%c\n",
> +          SCALE (s.total_allocated_map_size),
> +          STAT_LABEL (s.total_allocated_map_size));
> +  fprintf (stderr, "Total used maps size:                %5lu%c\n",
> +          SCALE (s.total_used_map_size),
> +          STAT_LABEL (s.total_used_map_size));
> +  fprintf (stderr, "Ordinary map used size:              %5lu%c\n",
> +          SCALE (s.ordinary_maps_used_size),
> +          STAT_LABEL (s.ordinary_maps_used_size));
> +  fprintf (stderr, "Macro maps used size:                %5lu%c\n",
> +          SCALE (s.macro_maps_used_size),
> +          STAT_LABEL (s.macro_maps_used_size));
> +  fprintf (stderr, "Number of ordinary maps allocated:   %5lu%c\n",
> +          SCALE (s.num_ordinary_maps_allocated),
> +          STAT_LABEL (s.num_ordinary_maps_allocated));
> +  fprintf (stderr, "Number of ordinary maps used:        %5lu%c\n",
> +          SCALE (s.num_ordinary_maps_used),
> +          STAT_LABEL (s.num_ordinary_maps_used));
> +  fprintf (stderr, "Number of macro maps used:           %5lu%c\n",
> +          SCALE (s.num_macro_maps_used),
> +          STAT_LABEL (s.num_macro_maps_used));
> +  fprintf (stderr, "Ordinary maps allocated size:        %5lu%c\n",
> +          SCALE (s.ordinary_maps_allocated_size),
> +          STAT_LABEL (s.ordinary_maps_allocated_size));
> +  fprintf (stderr, "Macro maps locations size:           %5lu%c\n",
> +          SCALE (s.macro_maps_locations_size),
> +          STAT_LABEL (s.macro_maps_locations_size));
> +  fprintf (stderr, "Duplicated maps locations size:      %5lu%c\n",
> +          SCALE (s.duplicated_macro_maps_locations_size),
> +          STAT_LABEL (s.duplicated_macro_maps_locations_size));

This seems oddly sorted.  And why the difference between ordinary and 
macro maps in terms of what is printed?

> +/* Counters defined in libcpp's macro.c.  */
> +extern unsigned num_expanded_macros_counter;
> +extern unsigned num_macro_tokens_counter;

These should be part of struct linemap_stats.

Jason



More information about the Gcc-patches mailing list