aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Goldblatt <davidgoldblatt@fb.com>2018-03-01 18:19:25 -0800
committerDavid Goldblatt <davidtgoldblatt@gmail.com>2018-03-09 11:47:17 -0800
commitec31d476ffa36885182f2b569ee518d3dfd54761 (patch)
tree92c30628c49d69596e6516631c3239483383b758 /src
parente5acc3540011fc6c3cec6aa97c567ff280617b74 (diff)
downloadplatform_external_jemalloc_new-ec31d476ffa36885182f2b569ee518d3dfd54761.tar.gz
platform_external_jemalloc_new-ec31d476ffa36885182f2b569ee518d3dfd54761.tar.bz2
platform_external_jemalloc_new-ec31d476ffa36885182f2b569ee518d3dfd54761.zip
Stats printing: Convert profiling stats to use the emitter.
While we're at it, print them in table form, too.
Diffstat (limited to 'src')
-rw-r--r--src/stats.c59
1 files changed, 28 insertions, 31 deletions
diff --git a/src/stats.c b/src/stats.c
index 432c5a1a..ca843e2d 100644
--- a/src/stats.c
+++ b/src/stats.c
@@ -797,6 +797,33 @@ stats_general_print(emitter_t *emitter, bool more) {
#undef OPT_WRITE_SSIZE_T_MUTABLE
#undef OPT_WRITE_CHAR_P
+ /* prof. */
+ if (config_prof) {
+ emitter_dict_begin(emitter, "prof", "Profiling settings");
+
+ CTL_GET("prof.thread_active_init", &bv, bool);
+ emitter_kv(emitter, "thread_active_init",
+ "prof.thread_active_emit", emitter_type_bool, &bv);
+
+ CTL_GET("prof.active", &bv, bool);
+ emitter_kv(emitter, "active", "prof.active", emitter_type_bool,
+ &bv);
+
+ CTL_GET("prof.gdump", &bv, bool);
+ emitter_kv(emitter, "gdump", "prof.gdump", emitter_type_bool,
+ &bv);
+
+ CTL_GET("prof.interval", &u64v, uint64_t);
+ emitter_kv(emitter, "interval", "prof.interval",
+ emitter_type_uint64, &u64v);
+
+ CTL_GET("prof.lg_sample", &ssv, ssize_t);
+ emitter_kv(emitter, "lg_sample", "prof.lg_sample",
+ emitter_type_ssize, &ssv);
+
+ emitter_dict_end(emitter); /* Close "prof". */
+ }
+
/* arenas. */
/*
* The json output sticks arena info into an "arenas" dict; the table
@@ -886,42 +913,12 @@ stats_general_print(emitter_t *emitter, bool more) {
emitter_json_dict_end(emitter); /* Close "arenas" */
if (json) {
- if (more || config_prof) {
+ if (more) {
malloc_cprintf(write_cb, cbopaque, ",\n");
} else {
malloc_cprintf(write_cb, cbopaque, "\n");
}
}
-
- /* prof. */
- if (config_prof && json) {
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\"prof\": {\n");
-
- CTL_GET("prof.thread_active_init", &bv, bool);
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\"thread_active_init\": %s,\n", bv ? "true" :
- "false");
-
- CTL_GET("prof.active", &bv, bool);
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\"active\": %s,\n", bv ? "true" : "false");
-
- CTL_GET("prof.gdump", &bv, bool);
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\"gdump\": %s,\n", bv ? "true" : "false");
-
- CTL_GET("prof.interval", &u64v, uint64_t);
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\"interval\": %"FMTu64",\n", u64v);
-
- CTL_GET("prof.lg_sample", &ssv, ssize_t);
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\"lg_sample\": %zd\n", ssv);
-
- malloc_cprintf(write_cb, cbopaque,
- "\t\t}%s\n", more ? "," : "");
- }
}
static void