aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Goldblatt <davidgoldblatt@fb.com>2018-03-02 11:57:13 -0800
committerDavid Goldblatt <davidtgoldblatt@gmail.com>2018-03-09 11:47:17 -0800
commit8076b28721e16d14a8a81bb6c17fba804812e110 (patch)
treefc62fc6dfb543490f8be8da080ef504fc41da36e /src
parent0d20eda127c4f35c16cfffad15857d3b286166ba (diff)
downloadplatform_external_jemalloc_new-8076b28721e16d14a8a81bb6c17fba804812e110.tar.gz
platform_external_jemalloc_new-8076b28721e16d14a8a81bb6c17fba804812e110.tar.bz2
platform_external_jemalloc_new-8076b28721e16d14a8a81bb6c17fba804812e110.zip
Stats printing: Remove explicit callback passing to stats_print_helper.
This makes the emitter the only source of callback information, which is a step towards where we want to be.
Diffstat (limited to 'src')
-rw-r--r--src/stats.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/stats.c b/src/stats.c
index 583c1316..709ce2d5 100644
--- a/src/stats.c
+++ b/src/stats.c
@@ -923,9 +923,16 @@ MUTEX_PROF_COUNTERS
}
static void
-stats_print_helper(void (*write_cb)(void *, const char *), void *cbopaque,
- bool json, bool merged, bool destroyed, bool unmerged, bool bins,
- bool large, bool mutex) {
+stats_print_helper(emitter_t *emitter, bool merged, bool destroyed,
+ bool unmerged, bool bins, bool large, bool mutex) {
+ /*
+ * These should be deleted. We keep them around for a while, to aid in
+ * the transition to the emitter code.
+ */
+ void (*write_cb)(void *, const char *) = emitter->write_cb;
+ void *cbopaque = emitter->cbopaque;
+ bool json = (emitter->output == emitter_output_json);
+
size_t allocated, active, metadata, metadata_thp, resident, mapped,
retained;
size_t num_background_threads;
@@ -1204,8 +1211,8 @@ stats_print(void (*write_cb)(void *, const char *), void *cbopaque,
malloc_cprintf(write_cb, cbopaque, "\n");
}
if (config_stats) {
- stats_print_helper(write_cb, cbopaque, json, merged, destroyed,
- unmerged, bins, large, mutex);
+ stats_print_helper(&emitter, merged, destroyed, unmerged,
+ bins, large, mutex);
}
emitter_json_dict_end(&emitter); /* Closes the "jemalloc" dict. */