Add "J" (JSON) support to malloc_stats_print().

This resolves #474.
This commit is contained in:
Jason Evans 2016-10-31 22:30:49 -07:00
parent b93f63b3eb
commit 0ba5b9b618
2 changed files with 754 additions and 351 deletions

View File

@ -410,28 +410,28 @@ for (i = 0; i < nbins; i++) {
/* Do something with bin_size... */ /* Do something with bin_size... */
}]]></programlisting></para> }]]></programlisting></para>
<para>The <function>malloc_stats_print()</function> function <para>The <function>malloc_stats_print()</function> function writes
writes human-readable summary statistics via the summary statistics via the <parameter>write_cb</parameter> callback
<parameter>write_cb</parameter> callback function pointer and function pointer and <parameter>cbopaque</parameter> data passed to
<parameter>cbopaque</parameter> data passed to <parameter>write_cb</parameter>, or <function>malloc_message()</function>
<parameter>write_cb</parameter>, or if <parameter>write_cb</parameter> is <constant>NULL</constant>. The
<function>malloc_message()</function> if statistics are presented in human-readable form unless "J" is specified as
<parameter>write_cb</parameter> is <constant>NULL</constant>. This a character within the <parameter>opts</parameter> string, in which case
function can be called repeatedly. General information that never changes the statistics are presented in <ulink url="http://www.json.org/">JSON
during execution can be omitted by specifying "g" as a character within format</ulink>. This function can be called repeatedly. General
the <parameter>opts</parameter> string. Note that information that never changes during execution can be omitted by
<function>malloc_message()</function> uses the specifying "g" as a character within the <parameter>opts</parameter>
<function>mallctl*()</function> functions internally, so string. Note that <function>malloc_message()</function> uses the
inconsistent statistics can be reported if multiple threads use these <function>mallctl*()</function> functions internally, so inconsistent
functions simultaneously. If <option>--enable-stats</option> is specified statistics can be reported if multiple threads use these functions
during configuration, &ldquo;m&rdquo; and &ldquo;a&rdquo; can be specified simultaneously. If <option>--enable-stats</option> is specified during
to omit merged arena and per arena statistics, respectively; configuration, &ldquo;m&rdquo; and &ldquo;a&rdquo; can be specified to
&ldquo;b&rdquo; and &ldquo;l&rdquo; can be specified to omit per size omit merged arena and per arena statistics, respectively; &ldquo;b&rdquo;
class statistics for bins and large objects, respectively. Unrecognized and &ldquo;l&rdquo; can be specified to omit per size class statistics for
characters are silently ignored. Note that thread caching may prevent bins and large objects, respectively. Unrecognized characters are
some statistics from being completely up to date, since extra locking silently ignored. Note that thread caching may prevent some statistics
would be required to merge counters that track thread cache from being completely up to date, since extra locking would be required to
operations.</para> merge counters that track thread cache operations.</para>
<para>The <function>malloc_usable_size()</function> function <para>The <function>malloc_usable_size()</function> function
returns the usable size of the allocation pointed to by returns the usable size of the allocation pointed to by

File diff suppressed because it is too large Load Diff