Skip to content

Commit b599b32

Browse files
committed
Add "J" (JSON) support to malloc_stats_print().
This resolves jemalloc#474.
1 parent 4752a54 commit b599b32

File tree

2 files changed

+876
-398
lines changed

2 files changed

+876
-398
lines changed

doc/jemalloc.xml.in

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -410,29 +410,30 @@ for (i = 0; i < nbins; i++) {
410410
/* Do something with bin_size... */
411411
}]]></programlisting></para>
412412

413-
<para>The <function>malloc_stats_print()</function> function
414-
writes human-readable summary statistics via the
415-
<parameter>write_cb</parameter> callback function pointer and
416-
<parameter>cbopaque</parameter> data passed to
417-
<parameter>write_cb</parameter>, or
418-
<function>malloc_message()</function> if
419-
<parameter>write_cb</parameter> is <constant>NULL</constant>. This
420-
function can be called repeatedly. General information that never
421-
changes during execution can be omitted by specifying "g" as a character
413+
<para>The <function>malloc_stats_print()</function> function writes
414+
summary statistics via the <parameter>write_cb</parameter> callback
415+
function pointer and <parameter>cbopaque</parameter> data passed to
416+
<parameter>write_cb</parameter>, or <function>malloc_message()</function>
417+
if <parameter>write_cb</parameter> is <constant>NULL</constant>. The
418+
statistics are presented in human-readable form unless <quote>J</quote> is
419+
specified as a character within the <parameter>opts</parameter> string, in
420+
which case the statistics are presented in <ulink
421+
url="http://www.json.org/">JSON format</ulink>. This function can be
422+
called repeatedly. General information that never changes during
423+
execution can be omitted by specifying <quote>g</quote> as a character
422424
within the <parameter>opts</parameter> string. Note that
423425
<function>malloc_message()</function> uses the
424-
<function>mallctl*()</function> functions internally, so
425-
inconsistent statistics can be reported if multiple threads use these
426-
functions simultaneously. If <option>--enable-stats</option> is
427-
specified during configuration, &ldquo;m&rdquo; and &ldquo;a&rdquo; can
428-
be specified to omit merged arena and per arena statistics, respectively;
429-
&ldquo;b&rdquo;, &ldquo;l&rdquo;, and &ldquo;h&rdquo; can be specified to
430-
omit per size class statistics for bins, large objects, and huge objects,
431-
respectively. Unrecognized characters are silently ignored. Note that
432-
thread caching may prevent some statistics from being completely up to
433-
date, since extra locking would be required to merge counters that track
434-
thread cache operations.
435-
</para>
426+
<function>mallctl*()</function> functions internally, so inconsistent
427+
statistics can be reported if multiple threads use these functions
428+
simultaneously. If <option>--enable-stats</option> is specified during
429+
configuration, <quote>m</quote> and <quote>a</quote> can be specified to
430+
omit merged arena and per arena statistics, respectively;
431+
<quote>b</quote>, <quote>l</quote>, and <quote>h</quote> can be specified
432+
to omit per size class statistics for bins, large objects, and huge
433+
objects, respectively. Unrecognized characters are silently ignored.
434+
Note that thread caching may prevent some statistics from being completely
435+
up to date, since extra locking would be required to merge counters that
436+
track thread cache operations.</para>
436437

437438
<para>The <function>malloc_usable_size()</function> function
438439
returns the usable size of the allocation pointed to by

0 commit comments

Comments
 (0)