Commit graph

14 commits

Author SHA1 Message Date
Behdad Esfahbod
25b6775cc6 [malloc-stats] Measure calloc 2023-01-26 14:20:12 -07:00
Behdad Esfahbod
71c4443139 [malloc-stats] Fix to not crash
Can't use constructor as malloc might be called before that.
2022-12-30 10:34:46 -07:00
Adrian Johnson
9bb2036369 Fix warning
../util/malloc-stats.c:295:1: warning: no previous declaration for ‘malloc_stats’ [-Wmissing-declarations]
2022-03-09 19:43:48 +10:30
Adrian Johnson
d2f1827cde Replace deprecated malloc_hook 2022-03-09 06:58:28 +10:30
Ravi Nanjundappa
52b137bc3e test and util: maintain consistency in the usage of ARRAY_LENGTH macro
ARRAY_LENGTH macro is used in perf's cairo-perf.h, src's cairoint.h,
test's cairo-test.h and in some internal header files of util's
directory.So to maintain consistency ARRAY_SIZE is replaced with
ARRAY_LENGTH macro.

Signed-off-by: Ravi Nanjundappa <nravi.n@samsung.com>
Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
2014-04-30 13:01:35 -07:00
Behdad Esfahbod
1054840d86 Fix malloc-stats for newer glibc 2012-09-22 15:59:36 -04:00
Behdad Esfahbod
38c6084758 [util/malloc-stats] Use tighter spacing. 2012-09-17 16:27:04 -04:00
Behdad Esfahbod
e63d725ad4 [utils] Remove unused code 2009-08-10 12:47:37 -04:00
Behdad Esfahbod
d63c1ab3ff [util/malloc-stats] Do a single backtrace_symbols() call
I was hoping that this may speed things up, but it didn't.  :(
2009-01-31 22:10:57 -05:00
Behdad Esfahbod
64d1c75870 [util] Fix memset bug in malloc-stats 2009-01-31 21:34:46 -05:00
Chris Wilson
dd11d905a5 [util] Use a hash-table for malloc-stats.
At Behdad's request, convert the array of allocators into a simple hash
table (large static number of buckets + chaining) in order to speed up
malloc profiling.
2009-01-30 10:18:15 +00:00
Behdad Esfahbod
78dac47399 [util/malloc-stats.c] Add a public function malloc_stats()
Apparently glibc already provides the function:

  void malloc_stats (void);

So, like we do for backtrace_symbols(), override the public symbol.
It still is defined as __destructor__ and runs at program finalization.
2007-12-10 14:38:48 -05:00
Behdad Esfahbod
4cce3135e0 Clear executable flag off .c file 2007-07-26 18:04:39 -04:00
Behdad Esfahbod
3b46e105bd [util] Import my malloc wrapper that prints simple statistics
To build, do:

	make malloc-stats.so

inside util/, and to use, run:

	LD_PRELOAD=malloc-stats.so some-program

For binaries managed by libtool, eg, cairo-perf, do:

	../libtool --mode=execute /bin/true ./cairo-perf
	LD_PRELOAD="../util/malloc-stats.so" .libs/lt-cairo-perf

The code also includes Jeff Muizelaar's libbacktracesymbols that
is a much better implementation of backtrace_symbols() than what
is provided by glibc.  That can be built by:

	make backtrace-symbols.so
2007-04-21 08:23:15 -04:00