From 64a1a422dba4b0c09ad38310e32a223f2e16ed9d Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Mon, 17 Oct 2011 09:59:52 +0000 Subject: 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 From-SVN: r180085 --- libcpp/include/line-map.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'libcpp/include/line-map.h') diff --git a/libcpp/include/line-map.h b/libcpp/include/line-map.h index 04a523c..572e330 100644 --- a/libcpp/include/line-map.h +++ b/libcpp/include/line-map.h @@ -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 *); -- cgit v1.1