Implement malloc_info(3).

Expose jemalloc stats through the malloc_info(3) interface.

Bug: 16874689
Change-Id: I4358ac283002e60ff161107028d1a3fb1e9afb0a
This commit is contained in:
Dan Albert
2014-08-20 09:16:57 -07:00
parent d5fbc37119
commit 4caa1f0977
7 changed files with 229 additions and 0 deletions

View File

@@ -24,6 +24,7 @@
*/
#include <sys/cdefs.h>
#include <stddef.h>
#include <stdio.h>
__BEGIN_DECLS
@@ -53,6 +54,27 @@ struct mallinfo {
extern struct mallinfo mallinfo(void);
/*
* XML structure for malloc_info(3) is in the following format:
*
* <malloc version="jemalloc-1">
* <heap nr="INT">
* <allocated-large>INT</allocated-large>
* <allocated-huge>INT</allocated-huge>
* <allocated-bins>INT</allocated-bins>
* <bins-total>INT</bins-total>
* <bin nr="INT">
* <allocated>INT</allocated>
* <nmalloc>INT</nmalloc>
* <ndalloc>INT</ndalloc>
* </bin>
* <!-- more bins -->
* </heap>
* <!-- more heaps -->
* </malloc>
*/
extern int malloc_info(int, FILE *);
__END_DECLS
#endif /* LIBC_INCLUDE_MALLOC_H_ */