From ac05926156c0997b191af1176122ee3d8663d19e Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Wed, 3 Jun 2015 11:33:32 +0200 Subject: Port pool-allocator memory stats to a new infrastructure. * alloc-pool.c (allocate_pool_descriptor): Remove. (struct pool_output_info): Likewise. (print_alloc_pool_statistics): Likewise. (dump_alloc_pool_statistics): Likewise. * alloc-pool.h (struct pool_usage): New struct. (pool_allocator::initialize): Change usage of memory statistics to a new interface. (pool_allocator::release): Likewise. (pool_allocator::allocate): Likewise. (pool_allocator::remove): Likewise. * mem-stats-traits.h (enum mem_alloc_origin): Add new enum value for a pool allocator. * mem-stats.h (struct mem_location): Add new ctor. (struct mem_usage): Add counter for number of instances. (mem_alloc_description::register_descriptor): New overload of * mem-stats.h (mem_location::to_string): New function. * bitmap.h (struct bitmap_usage): Use this new function. * ggc-common.c (struct ggc_usage): Likewise. the function. From-SVN: r224070 --- gcc/bitmap.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'gcc/bitmap.h') diff --git a/gcc/bitmap.h b/gcc/bitmap.h index 40562f6..4309f6d 100644 --- a/gcc/bitmap.h +++ b/gcc/bitmap.h @@ -156,18 +156,17 @@ struct bitmap_usage: public mem_usage /* Dump usage coupled to LOC location, where TOTAL is sum of all rows. */ inline void dump (mem_location *loc, mem_usage &total) const { - char s[4096]; - sprintf (s, "%s:%i (%s)", loc->get_trimmed_filename (), - loc->m_line, loc->m_function); + char *location_string = loc->to_string (); - s[48] = '\0'; - - fprintf (stderr, "%-48s %10li:%5.1f%%%10li%10li:%5.1f%%%12li%12li%10s\n", s, + fprintf (stderr, "%-48s %10li:%5.1f%%%10li%10li:%5.1f%%%12li%12li%10s\n", + location_string, (long)m_allocated, get_percent (m_allocated, total.m_allocated), (long)m_peak, (long)m_times, get_percent (m_times, total.m_times), (long)m_nsearches, (long)m_search_iter, loc->m_ggc ? "ggc" : "heap"); + + free (location_string); } /* Dump header with NAME. */ -- cgit v1.1