diff mbox

Add mmapped count and size in malloc_info

Message ID 20140530075749.GP12497@spoyarek.pnq.redhat.com
State New
Headers show

Commit Message

Siddhesh Poyarekar May 30, 2014, 7:57 a.m. UTC
Hi,

malloc_info currently only gives information about allocations on
heap, which is not complete without information about allocations that
were satisfied using mmap.  This trivial patch adds this information
as a new element to the xml.

This patch goes on top of Ondrej's patch to inline mi_arena.  OK to
commit?

Siddhesh

	* malloc/malloc (malloc_info): Also print mmapped statistics.

Comments

Ondřej Bílka May 30, 2014, 11:06 a.m. UTC | #1
On Fri, May 30, 2014 at 01:27:50PM +0530, Siddhesh Poyarekar wrote:
> Hi,
> 
> malloc_info currently only gives information about allocations on
> heap, which is not complete without information about allocations that
> were satisfied using mmap.  This trivial patch adds this information
> as a new element to the xml.
> 
> This patch goes on top of Ondrej's patch to inline mi_arena.  OK to
> commit?
> 
ok for me
Roland McGrath May 30, 2014, 4:22 p.m. UTC | #2
>             "<total type=\"fast\" count=\"%zu\" size=\"%zu\"/>\n"
>             "<total type=\"rest\" count=\"%zu\" size=\"%zu\"/>\n"
> +	   "<mmap nr=\"%zu\" size=\"%zu\"/>\n"

Looks like this should be:

	<total type="mmap" count="%zu" size="%zu"/>

No?
Siddhesh Poyarekar May 30, 2014, 4:59 p.m. UTC | #3
On 30 May 2014 21:52, Roland McGrath <roland@hack.frob.com> wrote:
>>             "<total type=\"fast\" count=\"%zu\" size=\"%zu\"/>\n"
>>             "<total type=\"rest\" count=\"%zu\" size=\"%zu\"/>\n"
>> +        "<mmap nr=\"%zu\" size=\"%zu\"/>\n"
>
> Looks like this should be:
>
>         <total type="mmap" count="%zu" size="%zu"/>
>
> No?

Thanks, that does read better.  I'll use it.

Siddhesh
diff mbox

Patch

diff --git a/malloc/malloc.c b/malloc/malloc.c
index 963a333..9e98c6d 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -5148,12 +5148,14 @@  malloc_info (int options, FILE *fp)
   fprintf (fp,
            "<total type=\"fast\" count=\"%zu\" size=\"%zu\"/>\n"
            "<total type=\"rest\" count=\"%zu\" size=\"%zu\"/>\n"
+	   "<mmap nr=\"%zu\" size=\"%zu\"/>\n"
            "<system type=\"current\" size=\"%zu\"/>\n"
            "<system type=\"max\" size=\"%zu\"/>\n"
            "<aspace type=\"total\" size=\"%zu\"/>\n"
            "<aspace type=\"mprotect\" size=\"%zu\"/>\n"
            "</malloc>\n",
            total_nfastblocks, total_fastavail, total_nblocks, total_avail,
+	   mp_.n_mmaps, mp_.mmapped_mem,
            total_system, total_max_system,
            total_aspace, total_aspace_mprotect);