statistical counters from jemalloc - Similar to mall info()
Jason Evans
jasone at canonware.com
Mon Oct 19 12:16:26 PDT 2015
On Oct 19, 2015, at 3:10 AM, Prajakta <praj.jagtap at gmail.com> wrote:
> Is there a way by which we can get actual number of bytes of data allocated by JEMALLOC + number of bytes allocated by mmap / bro system call in jemalloc?
>
> I am looking for counters similar to mallinfo counters in jemalloc.
> Using mall info() we get information about memory allocations performed using malloc.
>
> I need similar counters from jemalloc:
> - hblkhd: Number of bytes in blocks currently allocated using mmap(2)
> - uordblks: Total number of bytes usd by in-use allocations
> - fordblks: Total number of bytes in free blocks.
>
>
> Out of above 3, I suspect, stats.allocated is similar to uordblks.
Unfortunately, mallinfo()'s API has some implementation detail baked in, and it doesn't map perfectly to jemalloc. Nonetheless, jemalloc does provide similar, more detailed stats.
hblkhd: Under typical operating conditions, jemalloc allocates *all* memory via mmap(), so this stat isn't generally useful. That said, http://www.canonware.com/download/jemalloc/jemalloc-latest/doc/jemalloc.html#stats.arenas.i.large.allocated <http://www.canonware.com/download/jemalloc/jemalloc-latest/doc/jemalloc.html#stats.arenas.i.large.allocated> and http://www.canonware.com/download/jemalloc/jemalloc-latest/doc/jemalloc.html#stats.arenas.i.huge.allocated <http://www.canonware.com/download/jemalloc/jemalloc-latest/doc/jemalloc.html#stats.arenas.i.huge.allocated> may be of interest depending on your use case.
uordblks: Precisely the same as http://www.canonware.com/download/jemalloc/jemalloc-latest/doc/jemalloc.html#stats.allocated <http://www.canonware.com/download/jemalloc/jemalloc-latest/doc/jemalloc.html#stats.allocated> .
fordblks: Use http://www.canonware.com/download/jemalloc/jemalloc-latest/doc/jemalloc.html#stats.resident <http://www.canonware.com/download/jemalloc/jemalloc-latest/doc/jemalloc.html#stats.resident> or http://www.canonware.com/download/jemalloc/jemalloc-latest/doc/jemalloc.html#stats.mapped <http://www.canonware.com/download/jemalloc/jemalloc-latest/doc/jemalloc.html#stats.mapped> and subtract out http://www.canonware.com/download/jemalloc/jemalloc-latest/doc/jemalloc.html#stats.active <http://www.canonware.com/download/jemalloc/jemalloc-latest/doc/jemalloc.html#stats.active> .
Jason
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://jemalloc.net/mailman/jemalloc-discuss/attachments/20151019/7a30832f/attachment.html>
More information about the jemalloc-discuss
mailing list