Commit 80a4fe78 by Martin Liska Committed by Martin Liska

Fix GNU coding style in memory statistics.

	* alloc-pool.h (struct pool_usage): Correct GNU coding style.
	* bitmap.h (struct bitmap_usage): Likewise.
	* ggc-common.c (struct ggc_usage): Likewise.
	* mem-stats.h (struct mem_location): Likewise.
	(struct mem_usage): Likewise.
	* vec.c (struct vec_usage): Likewise.

From-SVN: r224082
parent 36805406
2015-06-03 Martin Liska <mliska@suse.cz>
* alloc-pool.h (struct pool_usage): Correct GNU coding style.
* bitmap.h (struct bitmap_usage): Likewise.
* ggc-common.c (struct ggc_usage): Likewise.
* mem-stats.h (struct mem_location): Likewise.
(struct mem_usage): Likewise.
* vec.c (struct vec_usage): Likewise.
2015-06-03 Benigno B. Junior <bbj@gentoo.org> 2015-06-03 Benigno B. Junior <bbj@gentoo.org>
* config/netbsd-elf.h (NETBSD_LINK_SPEC_ELF): Turn -symbolic into * config/netbsd-elf.h (NETBSD_LINK_SPEC_ELF): Turn -symbolic into
......
...@@ -40,7 +40,8 @@ struct pool_usage: public mem_usage ...@@ -40,7 +40,8 @@ struct pool_usage: public mem_usage
m_pool_name (pool_name) {} m_pool_name (pool_name) {}
/* Sum the usage with SECOND usage. */ /* Sum the usage with SECOND usage. */
pool_usage operator+ (const pool_usage &second) pool_usage
operator+ (const pool_usage &second)
{ {
return pool_usage (m_allocated + second.m_allocated, return pool_usage (m_allocated + second.m_allocated,
m_times + second.m_times, m_times + second.m_times,
...@@ -50,7 +51,8 @@ struct pool_usage: public mem_usage ...@@ -50,7 +51,8 @@ struct pool_usage: public mem_usage
} }
/* Dump usage coupled to LOC location, where TOTAL is sum of all rows. */ /* Dump usage coupled to LOC location, where TOTAL is sum of all rows. */
inline void dump (mem_location *loc, mem_usage &total) const inline void
dump (mem_location *loc, mem_usage &total) const
{ {
char *location_string = loc->to_string (); char *location_string = loc->to_string ();
...@@ -65,7 +67,8 @@ struct pool_usage: public mem_usage ...@@ -65,7 +67,8 @@ struct pool_usage: public mem_usage
} }
/* Dump header with NAME. */ /* Dump header with NAME. */
static inline void dump_header (const char *name) static inline void
dump_header (const char *name)
{ {
fprintf (stderr, "%-32s%-48s %6s%11s%16s%17s%12s\n", "Pool name", name, fprintf (stderr, "%-32s%-48s %6s%11s%16s%17s%12s\n", "Pool name", name,
"Pools", "Leak", "Peak", "Times", "Elt size"); "Pools", "Leak", "Peak", "Times", "Elt size");
...@@ -73,7 +76,8 @@ struct pool_usage: public mem_usage ...@@ -73,7 +76,8 @@ struct pool_usage: public mem_usage
} }
/* Dump footer. */ /* Dump footer. */
inline void dump_footer () inline void
dump_footer ()
{ {
print_dash_line (); print_dash_line ();
fprintf (stderr, "%s%82li%10li\n", "Total", (long)m_instances, fprintf (stderr, "%s%82li%10li\n", "Total", (long)m_instances,
...@@ -133,21 +137,24 @@ private: ...@@ -133,21 +137,24 @@ private:
int64_t align_i; int64_t align_i;
} u; } u;
static inline allocation_object<U> *get_instance (void *data_ptr) static inline allocation_object<U> *
get_instance (void *data_ptr)
{ {
return (allocation_object<U> *)(((char *)(data_ptr)) return (allocation_object<U> *)(((char *)(data_ptr))
- offsetof (allocation_object<U>, - offsetof (allocation_object<U>,
u.data)); u.data));
} }
static inline U *get_data (void *instance_ptr) static inline U *
get_data (void *instance_ptr)
{ {
return (U*)(((allocation_object<U> *) instance_ptr)->u.data); return (U*)(((allocation_object<U> *) instance_ptr)->u.data);
} }
}; };
/* Align X to 8. */ /* Align X to 8. */
size_t align_eight (size_t x) size_t
align_eight (size_t x)
{ {
return (((x+7) >> 3) << 3); return (((x+7) >> 3) << 3);
} }
......
...@@ -144,7 +144,8 @@ struct bitmap_usage: public mem_usage ...@@ -144,7 +144,8 @@ struct bitmap_usage: public mem_usage
m_nsearches (nsearches), m_search_iter (search_iter) {} m_nsearches (nsearches), m_search_iter (search_iter) {}
/* Sum the usage with SECOND usage. */ /* Sum the usage with SECOND usage. */
bitmap_usage operator+ (const bitmap_usage &second) bitmap_usage
operator+ (const bitmap_usage &second)
{ {
return bitmap_usage (m_allocated + second.m_allocated, return bitmap_usage (m_allocated + second.m_allocated,
m_times + second.m_times, m_times + second.m_times,
...@@ -154,7 +155,8 @@ struct bitmap_usage: public mem_usage ...@@ -154,7 +155,8 @@ struct bitmap_usage: public mem_usage
} }
/* Dump usage coupled to LOC location, where TOTAL is sum of all rows. */ /* Dump usage coupled to LOC location, where TOTAL is sum of all rows. */
inline void dump (mem_location *loc, mem_usage &total) const inline void
dump (mem_location *loc, mem_usage &total) const
{ {
char *location_string = loc->to_string (); char *location_string = loc->to_string ();
...@@ -170,7 +172,8 @@ struct bitmap_usage: public mem_usage ...@@ -170,7 +172,8 @@ struct bitmap_usage: public mem_usage
} }
/* Dump header with NAME. */ /* Dump header with NAME. */
static inline void dump_header (const char *name) static inline void
dump_header (const char *name)
{ {
fprintf (stderr, "%-48s %11s%16s%17s%12s%12s%10s\n", name, "Leak", "Peak", fprintf (stderr, "%-48s %11s%16s%17s%12s%12s%10s\n", name, "Leak", "Peak",
"Times", "N searches", "Search iter", "Type"); "Times", "N searches", "Search iter", "Type");
......
...@@ -843,7 +843,8 @@ struct ggc_usage: public mem_usage ...@@ -843,7 +843,8 @@ struct ggc_usage: public mem_usage
m_freed (freed), m_collected (collected), m_overhead (overhead) {} m_freed (freed), m_collected (collected), m_overhead (overhead) {}
/* Comparison operator. */ /* Comparison operator. */
inline bool operator< (const ggc_usage &second) const inline bool
operator< (const ggc_usage &second) const
{ {
return (get_balance () == second.get_balance () ? return (get_balance () == second.get_balance () ?
(m_peak == second.m_peak ? m_times < second.m_times (m_peak == second.m_peak ? m_times < second.m_times
...@@ -852,7 +853,8 @@ struct ggc_usage: public mem_usage ...@@ -852,7 +853,8 @@ struct ggc_usage: public mem_usage
} }
/* Register overhead of ALLOCATED and OVERHEAD bytes. */ /* Register overhead of ALLOCATED and OVERHEAD bytes. */
inline void register_overhead (size_t allocated, size_t overhead) inline void
register_overhead (size_t allocated, size_t overhead)
{ {
m_allocated += allocated; m_allocated += allocated;
m_overhead += overhead; m_overhead += overhead;
...@@ -860,13 +862,15 @@ struct ggc_usage: public mem_usage ...@@ -860,13 +862,15 @@ struct ggc_usage: public mem_usage
} }
/* Release overhead of SIZE bytes. */ /* Release overhead of SIZE bytes. */
inline void release_overhead (size_t size) inline void
release_overhead (size_t size)
{ {
m_freed += size; m_freed += size;
} }
/* Sum the usage with SECOND usage. */ /* Sum the usage with SECOND usage. */
ggc_usage operator+ (const ggc_usage &second) ggc_usage
operator+ (const ggc_usage &second)
{ {
return ggc_usage (m_allocated + second.m_allocated, return ggc_usage (m_allocated + second.m_allocated,
m_times + second.m_times, m_times + second.m_times,
...@@ -877,7 +881,8 @@ struct ggc_usage: public mem_usage ...@@ -877,7 +881,8 @@ struct ggc_usage: public mem_usage
} }
/* Dump usage with PREFIX, where TOTAL is sum of all rows. */ /* Dump usage with PREFIX, where TOTAL is sum of all rows. */
inline void dump (const char *prefix, ggc_usage &total) const inline void
dump (const char *prefix, ggc_usage &total) const
{ {
long balance = get_balance (); long balance = get_balance ();
fprintf (stderr, fprintf (stderr,
...@@ -892,7 +897,8 @@ struct ggc_usage: public mem_usage ...@@ -892,7 +897,8 @@ struct ggc_usage: public mem_usage
} }
/* Dump usage coupled to LOC location, where TOTAL is sum of all rows. */ /* Dump usage coupled to LOC location, where TOTAL is sum of all rows. */
inline void dump (mem_location *loc, ggc_usage &total) const inline void
dump (mem_location *loc, ggc_usage &total) const
{ {
char *location_string = loc->to_string (); char *location_string = loc->to_string ();
...@@ -902,7 +908,8 @@ struct ggc_usage: public mem_usage ...@@ -902,7 +908,8 @@ struct ggc_usage: public mem_usage
} }
/* Dump footer. */ /* Dump footer. */
inline void dump_footer () inline void
dump_footer ()
{ {
print_dash_line (); print_dash_line ();
dump ("Total", *this); dump ("Total", *this);
...@@ -910,7 +917,8 @@ struct ggc_usage: public mem_usage ...@@ -910,7 +917,8 @@ struct ggc_usage: public mem_usage
} }
/* Get balance which is GGC allocation leak. */ /* Get balance which is GGC allocation leak. */
inline long get_balance () const inline long
get_balance () const
{ {
return m_allocated + m_overhead - m_collected - m_freed; return m_allocated + m_overhead - m_collected - m_freed;
} }
...@@ -918,7 +926,8 @@ struct ggc_usage: public mem_usage ...@@ -918,7 +926,8 @@ struct ggc_usage: public mem_usage
typedef std::pair<mem_location *, ggc_usage *> mem_pair_t; typedef std::pair<mem_location *, ggc_usage *> mem_pair_t;
/* Compare wrapper used by qsort method. */ /* Compare wrapper used by qsort method. */
static int compare (const void *first, const void *second) static int
compare (const void *first, const void *second)
{ {
const mem_pair_t f = *(const mem_pair_t *)first; const mem_pair_t f = *(const mem_pair_t *)first;
const mem_pair_t s = *(const mem_pair_t *)second; const mem_pair_t s = *(const mem_pair_t *)second;
...@@ -927,8 +936,10 @@ struct ggc_usage: public mem_usage ...@@ -927,8 +936,10 @@ struct ggc_usage: public mem_usage
} }
/* Compare rows in final GGC summary dump. */ /* Compare rows in final GGC summary dump. */
static int compare_final (const void *first, const void *second) static int
{ typedef std::pair<mem_location *, ggc_usage *> mem_pair_t; compare_final (const void *first, const void *second)
{
typedef std::pair<mem_location *, ggc_usage *> mem_pair_t;
const ggc_usage *f = ((const mem_pair_t *)first)->second; const ggc_usage *f = ((const mem_pair_t *)first)->second;
const ggc_usage *s = ((const mem_pair_t *)second)->second; const ggc_usage *s = ((const mem_pair_t *)second)->second;
...@@ -940,7 +951,8 @@ struct ggc_usage: public mem_usage ...@@ -940,7 +951,8 @@ struct ggc_usage: public mem_usage
} }
/* Dump header with NAME. */ /* Dump header with NAME. */
static inline void dump_header (const char *name) static inline void
dump_header (const char *name)
{ {
fprintf (stderr, "%-48s %11s%17s%17s%16s%17s\n", name, "Garbage", "Freed", fprintf (stderr, "%-48s %11s%17s%17s%16s%17s\n", name, "Garbage", "Freed",
"Leak", "Overhead", "Times"); "Leak", "Overhead", "Times");
......
...@@ -18,17 +18,20 @@ class hash_map; ...@@ -18,17 +18,20 @@ class hash_map;
struct mem_location struct mem_location
{ {
/* Default constructor. */ /* Default constructor. */
inline mem_location () {} inline
mem_location () {}
/* Constructor. */ /* Constructor. */
inline mem_location (mem_alloc_origin origin, bool ggc, inline
mem_location (mem_alloc_origin origin, bool ggc,
const char *filename = NULL, int line = 0, const char *filename = NULL, int line = 0,
const char *function = NULL): const char *function = NULL):
m_filename (filename), m_function (function), m_line (line), m_origin m_filename (filename), m_function (function), m_line (line), m_origin
(origin), m_ggc (ggc) {} (origin), m_ggc (ggc) {}
/* Copy constructor. */ /* Copy constructor. */
inline mem_location (mem_location &other): m_filename (other.m_filename), inline
mem_location (mem_location &other): m_filename (other.m_filename),
m_function (other.m_function), m_line (other.m_line), m_function (other.m_function), m_line (other.m_line),
m_origin (other.m_origin), m_ggc (other.m_ggc) {} m_origin (other.m_origin), m_ggc (other.m_ggc) {}
...@@ -36,7 +39,8 @@ struct mem_location ...@@ -36,7 +39,8 @@ struct mem_location
source code. As there is just a single pointer registered for every source code. As there is just a single pointer registered for every
constant that points to e.g. the same file name, we can use hash constant that points to e.g. the same file name, we can use hash
of the pointer. */ of the pointer. */
hashval_t hash () hashval_t
hash ()
{ {
inchash::hash hash; inchash::hash hash;
...@@ -48,14 +52,16 @@ struct mem_location ...@@ -48,14 +52,16 @@ struct mem_location
} }
/* Return true if the memory location is equal to OTHER. */ /* Return true if the memory location is equal to OTHER. */
int equal (mem_location &other) int
equal (mem_location &other)
{ {
return m_filename == other.m_filename && m_function == other.m_function return m_filename == other.m_filename && m_function == other.m_function
&& m_line == other.m_line; && m_line == other.m_line;
} }
/* Return trimmed filename for the location. */ /* Return trimmed filename for the location. */
inline const char *get_trimmed_filename () inline const char *
get_trimmed_filename ()
{ {
const char *s1 = m_filename; const char *s1 = m_filename;
const char *s2; const char *s2;
...@@ -66,7 +72,8 @@ struct mem_location ...@@ -66,7 +72,8 @@ struct mem_location
return s1; return s1;
} }
inline char *to_string () inline char *
to_string ()
{ {
unsigned l = strlen (get_trimmed_filename ()) + strlen (m_function) unsigned l = strlen (get_trimmed_filename ()) + strlen (m_function)
+ LOCATION_LINE_EXTRA_SPACE; + LOCATION_LINE_EXTRA_SPACE;
...@@ -81,7 +88,8 @@ struct mem_location ...@@ -81,7 +88,8 @@ struct mem_location
} }
/* Return display name associated to ORIGIN type. */ /* Return display name associated to ORIGIN type. */
static const char *get_origin_name (mem_alloc_origin origin) static const char *
get_origin_name (mem_alloc_origin origin)
{ {
return mem_alloc_origin_names[(unsigned) origin]; return mem_alloc_origin_names[(unsigned) origin];
} }
...@@ -110,7 +118,8 @@ struct mem_usage ...@@ -110,7 +118,8 @@ struct mem_usage
m_instances (instances) {} m_instances (instances) {}
/* Register overhead of SIZE bytes. */ /* Register overhead of SIZE bytes. */
inline void register_overhead (size_t size) inline void
register_overhead (size_t size)
{ {
m_allocated += size; m_allocated += size;
m_times++; m_times++;
...@@ -120,7 +129,8 @@ struct mem_usage ...@@ -120,7 +129,8 @@ struct mem_usage
} }
/* Release overhead of SIZE bytes. */ /* Release overhead of SIZE bytes. */
inline void release_overhead (size_t size) inline void
release_overhead (size_t size)
{ {
gcc_assert (size <= m_allocated); gcc_assert (size <= m_allocated);
...@@ -128,7 +138,8 @@ struct mem_usage ...@@ -128,7 +138,8 @@ struct mem_usage
} }
/* Sum the usage with SECOND usage. */ /* Sum the usage with SECOND usage. */
mem_usage operator+ (const mem_usage &second) mem_usage
operator+ (const mem_usage &second)
{ {
return mem_usage (m_allocated + second.m_allocated, return mem_usage (m_allocated + second.m_allocated,
m_times + second.m_times, m_times + second.m_times,
...@@ -137,7 +148,8 @@ struct mem_usage ...@@ -137,7 +148,8 @@ struct mem_usage
} }
/* Comparison operator. */ /* Comparison operator. */
inline bool operator< (const mem_usage &second) const inline bool
operator< (const mem_usage &second) const
{ {
return (m_allocated == second.m_allocated ? return (m_allocated == second.m_allocated ?
(m_peak == second.m_peak ? m_times < second.m_times (m_peak == second.m_peak ? m_times < second.m_times
...@@ -145,7 +157,8 @@ struct mem_usage ...@@ -145,7 +157,8 @@ struct mem_usage
} }
/* Compare wrapper used by qsort method. */ /* Compare wrapper used by qsort method. */
static int compare (const void *first, const void *second) static int
compare (const void *first, const void *second)
{ {
typedef std::pair<mem_location *, mem_usage *> mem_pair_t; typedef std::pair<mem_location *, mem_usage *> mem_pair_t;
...@@ -156,7 +169,8 @@ struct mem_usage ...@@ -156,7 +169,8 @@ struct mem_usage
} }
/* Dump usage coupled to LOC location, where TOTAL is sum of all rows. */ /* Dump usage coupled to LOC location, where TOTAL is sum of all rows. */
inline void dump (mem_location *loc, mem_usage &total) const inline void
dump (mem_location *loc, mem_usage &total) const
{ {
char *location_string = loc->to_string (); char *location_string = loc->to_string ();
...@@ -170,7 +184,8 @@ struct mem_usage ...@@ -170,7 +184,8 @@ struct mem_usage
} }
/* Dump footer. */ /* Dump footer. */
inline void dump_footer () const inline void
dump_footer () const
{ {
print_dash_line (); print_dash_line ();
fprintf (stderr, "%s%54li%27li\n", "Total", (long)m_allocated, fprintf (stderr, "%s%54li%27li\n", "Total", (long)m_allocated,
...@@ -179,19 +194,22 @@ struct mem_usage ...@@ -179,19 +194,22 @@ struct mem_usage
} }
/* Return fraction of NOMINATOR and DENOMINATOR in percent. */ /* Return fraction of NOMINATOR and DENOMINATOR in percent. */
static inline float get_percent (size_t nominator, size_t denominator) static inline float
get_percent (size_t nominator, size_t denominator)
{ {
return denominator == 0 ? 0.0f : nominator * 100.0 / denominator; return denominator == 0 ? 0.0f : nominator * 100.0 / denominator;
} }
/* Print line made of dashes. */ /* Print line made of dashes. */
static inline void print_dash_line (size_t count = 140) static inline void
print_dash_line (size_t count = 140)
{ {
fprintf (stderr, "%s\n", std::string (count, '-').c_str ()); fprintf (stderr, "%s\n", std::string (count, '-').c_str ());
} }
/* Dump header with NAME. */ /* Dump header with NAME. */
static inline void dump_header (const char *name) static inline void
dump_header (const char *name)
{ {
fprintf (stderr, "%-48s %11s%16s%10s%17s\n", name, "Leak", "Peak", fprintf (stderr, "%-48s %11s%16s%10s%17s\n", name, "Leak", "Peak",
"Times", "Type"); "Times", "Type");
...@@ -262,50 +280,59 @@ public: ...@@ -262,50 +280,59 @@ public:
~mem_alloc_description (); ~mem_alloc_description ();
/* Returns true if instance PTR is registered by the memory description. */ /* Returns true if instance PTR is registered by the memory description. */
bool contains_descriptor_for_instance (const void *ptr); bool
contains_descriptor_for_instance (const void *ptr);
/* Return descriptor for instance PTR. */ /* Return descriptor for instance PTR. */
T *get_descriptor_for_instance (const void *ptr); T *
get_descriptor_for_instance (const void *ptr);
/* Register memory allocation descriptor for container PTR which is /* Register memory allocation descriptor for container PTR which is
described by a memory LOCATION. */ described by a memory LOCATION. */
T *register_descriptor (const void *ptr, mem_location *location); T *
register_descriptor (const void *ptr, mem_location *location);
/* Register memory allocation descriptor for container PTR. ORIGIN identifies /* Register memory allocation descriptor for container PTR. ORIGIN identifies
type of container and GGC identifes if the allocation is handled in GGC type of container and GGC identifes if the allocation is handled in GGC
memory. Each location is identified by file NAME, LINE in source code and memory. Each location is identified by file NAME, LINE in source code and
FUNCTION name. */ FUNCTION name. */
T *register_descriptor (const void *ptr, mem_alloc_origin origin, T *
register_descriptor (const void *ptr, mem_alloc_origin origin,
bool ggc, const char *name, int line, bool ggc, const char *name, int line,
const char *function); const char *function);
/* Register instance overhead identified by PTR pointer. Allocation takes /* Register instance overhead identified by PTR pointer. Allocation takes
SIZE bytes. */ SIZE bytes. */
T *register_instance_overhead (size_t size, const void *ptr); T *
register_instance_overhead (size_t size, const void *ptr);
/* For containers (and GGC) where we want to track every instance object, /* For containers (and GGC) where we want to track every instance object,
we register allocation of SIZE bytes, identified by PTR pointer, belonging we register allocation of SIZE bytes, identified by PTR pointer, belonging
to USAGE descriptor. */ to USAGE descriptor. */
void register_object_overhead (T *usage, size_t size, const void *ptr); void
register_object_overhead (T *usage, size_t size, const void *ptr);
/* Release PTR pointer of SIZE bytes. If REMOVE_FROM_MAP is set to true, /* Release PTR pointer of SIZE bytes. If REMOVE_FROM_MAP is set to true,
remove the instance from reverse map. */ remove the instance from reverse map. */
void release_instance_overhead (void *ptr, size_t size, void
release_instance_overhead (void *ptr, size_t size,
bool remove_from_map = false); bool remove_from_map = false);
/* Release intance object identified by PTR pointer. */ /* Release intance object identified by PTR pointer. */
void release_object_overhead (void *ptr); void
release_object_overhead (void *ptr);
/* Get sum value for ORIGIN type of allocation for the descriptor. */ /* Get sum value for ORIGIN type of allocation for the descriptor. */
T get_sum (mem_alloc_origin origin); T
get_sum (mem_alloc_origin origin);
/* Get all tracked instances registered by the description. Items /* Get all tracked instances registered by the description. Items
are filtered by ORIGIN type, LENGTH is return value where we register are filtered by ORIGIN type, LENGTH is return value where we register
the number of elements in the list. If we want to process custom order, the number of elements in the list. If we want to process custom order,
CMP comparator can be provided. */ CMP comparator can be provided. */
mem_list_t *get_list (mem_alloc_origin origin, unsigned *length, mem_list_t *
int (*cmp) (const void *first, const void *second) get_list (mem_alloc_origin origin, unsigned *length,
= NULL); int (*cmp) (const void *first, const void *second) = NULL);
/* Dump all tracked instances of type ORIGIN. If we want to process custom /* Dump all tracked instances of type ORIGIN. If we want to process custom
order, CMP comparator can be provided. */ order, CMP comparator can be provided. */
......
...@@ -60,7 +60,8 @@ struct vec_usage: public mem_usage ...@@ -60,7 +60,8 @@ struct vec_usage: public mem_usage
m_items (items), m_items_peak (items_peak) {} m_items (items), m_items_peak (items_peak) {}
/* Comparison operator. */ /* Comparison operator. */
inline bool operator< (const vec_usage &second) const inline bool
operator< (const vec_usage &second) const
{ {
return (m_allocated == second.m_allocated ? return (m_allocated == second.m_allocated ?
(m_peak == second.m_peak ? m_times < second.m_times (m_peak == second.m_peak ? m_times < second.m_times
...@@ -68,7 +69,8 @@ struct vec_usage: public mem_usage ...@@ -68,7 +69,8 @@ struct vec_usage: public mem_usage
} }
/* Sum the usage with SECOND usage. */ /* Sum the usage with SECOND usage. */
vec_usage operator+ (const vec_usage &second) vec_usage
operator+ (const vec_usage &second)
{ {
return vec_usage (m_allocated + second.m_allocated, return vec_usage (m_allocated + second.m_allocated,
m_times + second.m_times, m_times + second.m_times,
...@@ -78,7 +80,8 @@ struct vec_usage: public mem_usage ...@@ -78,7 +80,8 @@ struct vec_usage: public mem_usage
} }
/* Dump usage coupled to LOC location, where TOTAL is sum of all rows. */ /* Dump usage coupled to LOC location, where TOTAL is sum of all rows. */
inline void dump (mem_location *loc, mem_usage &total) const inline void
dump (mem_location *loc, mem_usage &total) const
{ {
char s[4096]; char s[4096];
sprintf (s, "%s:%i (%s)", loc->get_trimmed_filename (), sprintf (s, "%s:%i (%s)", loc->get_trimmed_filename (),
...@@ -93,7 +96,8 @@ struct vec_usage: public mem_usage ...@@ -93,7 +96,8 @@ struct vec_usage: public mem_usage
} }
/* Dump footer. */ /* Dump footer. */
inline void dump_footer () inline void
dump_footer ()
{ {
print_dash_line (); print_dash_line ();
fprintf (stderr, "%s%55li%25li%17li\n", "Total", (long)m_allocated, fprintf (stderr, "%s%55li%25li%17li\n", "Total", (long)m_allocated,
...@@ -102,7 +106,8 @@ struct vec_usage: public mem_usage ...@@ -102,7 +106,8 @@ struct vec_usage: public mem_usage
} }
/* Dump header with NAME. */ /* Dump header with NAME. */
static inline void dump_header (const char *name) static inline void
dump_header (const char *name)
{ {
fprintf (stderr, "%-48s %11s%15s%10s%17s%11s\n", name, "Leak", "Peak", fprintf (stderr, "%-48s %11s%15s%10s%17s%11s\n", name, "Leak", "Peak",
"Times", "Leak items", "Peak items"); "Times", "Leak items", "Peak items");
...@@ -110,7 +115,8 @@ struct vec_usage: public mem_usage ...@@ -110,7 +115,8 @@ struct vec_usage: public mem_usage
} }
/* Compare wrapper used by qsort method. */ /* Compare wrapper used by qsort method. */
static int compare (const void *first, const void *second) static int
compare (const void *first, const void *second)
{ {
typedef std::pair<mem_location *, vec_usage *> mem_pair_t; typedef std::pair<mem_location *, vec_usage *> mem_pair_t;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment