Add line map statistics to -fmem-report output

This patch adds statistics about line maps' memory consumption and
macro expansion to the output of -fmem-report.  It has been useful in
trying to reduce the memory consumption of the macro maps support.

Co-Authored-By: Dodji Seketeli <dodji@redhat.com>

From-SVN: r180085
This commit is contained in:
Tom Tromey 2011-10-17 09:59:52 +00:00 committed by Dodji Seketeli
parent 847e697a24
commit 64a1a422db
8 changed files with 231 additions and 4 deletions

View file

@ -675,6 +675,27 @@ expanded_location linemap_expand_location_full (struct line_maps *,
source_location loc,
enum location_resolution_kind lrk);
/* Statistics about maps allocation and usage as returned by
linemap_get_statistics. */
struct linemap_stats
{
size_t num_ordinary_maps_allocated;
size_t num_ordinary_maps_used;
size_t ordinary_maps_allocated_size;
size_t ordinary_maps_used_size;
size_t num_expanded_macros;
size_t num_macro_tokens;
size_t num_macro_maps_used;
size_t macro_maps_allocated_size;
size_t macro_maps_used_size;
size_t macro_maps_locations_size;
size_t duplicated_macro_maps_locations_size;
};
/* Compute and return statistics about the memory consumption of some
parts of the line table SET. */
void linemap_get_statistics (struct line_maps *, struct linemap_stats *);
/* Dump debugging information about source location LOC into the file
stream STREAM. SET is the line map set LOC comes from. */
void linemap_dump_location (struct line_maps *, source_location, FILE *);