aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Goldblatt <davidgoldblatt@fb.com>2018-03-01 19:01:05 -0800
committerDavid Goldblatt <davidtgoldblatt@gmail.com>2018-03-09 11:47:17 -0800
commit0d20eda127c4f35c16cfffad15857d3b286166ba (patch)
tree0f3f51891d25c504777ac0db7a7949a4d6fd3a8d /src
parentec31d476ffa36885182f2b569ee518d3dfd54761 (diff)
downloadplatform_external_jemalloc_new-0d20eda127c4f35c16cfffad15857d3b286166ba.tar.gz
platform_external_jemalloc_new-0d20eda127c4f35c16cfffad15857d3b286166ba.tar.bz2
platform_external_jemalloc_new-0d20eda127c4f35c16cfffad15857d3b286166ba.zip
Stats printing: Move emitter -> manual cutoff point.
This makes it so that the "general" portion of the stats code is completely agnostic to emitter type.
Diffstat (limited to 'src')
-rw-r--r--src/stats.c29
1 files changed, 11 insertions, 18 deletions
diff --git a/src/stats.c b/src/stats.c
index ca843e2d..583c1316 100644
--- a/src/stats.c
+++ b/src/stats.c
@@ -668,15 +668,7 @@ stats_arena_print(void (*write_cb)(void *, const char *), void *cbopaque,
}
static void
-stats_general_print(emitter_t *emitter, bool more) {
- /*
- * These should eventually be deleted; they are useful in converting
- * from manual to emitter-based stats output, though.
- */
- void (*write_cb)(void *, const char *) = emitter->write_cb;
- void *cbopaque = emitter->cbopaque;
- bool json = (emitter->output == emitter_output_json);
-
+stats_general_print(emitter_t *emitter) {
const char *cpv;
bool bv, bv2;
unsigned uv;
@@ -911,14 +903,6 @@ stats_general_print(emitter_t *emitter, bool more) {
}
emitter_json_dict_end(emitter); /* Close "arenas" */
-
- if (json) {
- if (more) {
- malloc_cprintf(write_cb, cbopaque, ",\n");
- } else {
- malloc_cprintf(write_cb, cbopaque, "\n");
- }
- }
}
static void
@@ -1208,7 +1192,16 @@ stats_print(void (*write_cb)(void *, const char *), void *cbopaque,
emitter_json_dict_begin(&emitter, "jemalloc");
if (general) {
- stats_general_print(&emitter, config_stats);
+ stats_general_print(&emitter);
+
+ if (json) {
+ if (config_stats) {
+ malloc_cprintf(write_cb, cbopaque, ",");
+ }
+ }
+ }
+ if (json) {
+ malloc_cprintf(write_cb, cbopaque, "\n");
}
if (config_stats) {
stats_print_helper(write_cb, cbopaque, json, merged, destroyed,