Fix JSON-mode output for !config_stats and/or !config_prof cases.
These bugs were introduced by b599b32280
(Add "J" (JSON) support to malloc_stats_print().), which was first
released in 4.3.0.
This resolves #615.
This commit is contained in:
parent
adae7cfc4a
commit
61d26425e5
19
src/stats.c
19
src/stats.c
@ -555,7 +555,7 @@ stats_arena_print(void (*write_cb)(void *, const char *), void *cbopaque,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
stats_general_print(void (*write_cb)(void *, const char *), void *cbopaque,
|
stats_general_print(void (*write_cb)(void *, const char *), void *cbopaque,
|
||||||
bool json, bool merged, bool unmerged)
|
bool json, bool more)
|
||||||
{
|
{
|
||||||
const char *cpv;
|
const char *cpv;
|
||||||
bool bv;
|
bool bv;
|
||||||
@ -907,11 +907,11 @@ stats_general_print(void (*write_cb)(void *, const char *), void *cbopaque,
|
|||||||
"\t\t\t]\n");
|
"\t\t\t]\n");
|
||||||
|
|
||||||
malloc_cprintf(write_cb, cbopaque,
|
malloc_cprintf(write_cb, cbopaque,
|
||||||
"\t\t},\n");
|
"\t\t}%s\n", (config_prof || more) ? "," : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* prof. */
|
/* prof. */
|
||||||
if (json) {
|
if (config_prof && json) {
|
||||||
malloc_cprintf(write_cb, cbopaque,
|
malloc_cprintf(write_cb, cbopaque,
|
||||||
"\t\t\"prof\": {\n");
|
"\t\t\"prof\": {\n");
|
||||||
|
|
||||||
@ -937,8 +937,7 @@ stats_general_print(void (*write_cb)(void *, const char *), void *cbopaque,
|
|||||||
"\t\t\t\"lg_sample\": %zd\n", ssv);
|
"\t\t\t\"lg_sample\": %zd\n", ssv);
|
||||||
|
|
||||||
malloc_cprintf(write_cb, cbopaque,
|
malloc_cprintf(write_cb, cbopaque,
|
||||||
"\t\t}%s\n", (config_stats || merged || unmerged) ? "," :
|
"\t\t}%s\n", more ? "," : "");
|
||||||
"");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1069,8 +1068,8 @@ stats_print(void (*write_cb)(void *, const char *), void *cbopaque,
|
|||||||
size_t u64sz;
|
size_t u64sz;
|
||||||
bool json = false;
|
bool json = false;
|
||||||
bool general = true;
|
bool general = true;
|
||||||
bool merged = true;
|
bool merged = config_stats;
|
||||||
bool unmerged = true;
|
bool unmerged = config_stats;
|
||||||
bool bins = true;
|
bool bins = true;
|
||||||
bool large = true;
|
bool large = true;
|
||||||
bool huge = true;
|
bool huge = true;
|
||||||
@ -1137,8 +1136,10 @@ stats_print(void (*write_cb)(void *, const char *), void *cbopaque,
|
|||||||
"___ Begin jemalloc statistics ___\n");
|
"___ Begin jemalloc statistics ___\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (general)
|
if (general) {
|
||||||
stats_general_print(write_cb, cbopaque, json, merged, unmerged);
|
bool more = (merged || unmerged);
|
||||||
|
stats_general_print(write_cb, cbopaque, json, more);
|
||||||
|
}
|
||||||
if (config_stats) {
|
if (config_stats) {
|
||||||
stats_print_helper(write_cb, cbopaque, json, merged, unmerged,
|
stats_print_helper(write_cb, cbopaque, json, merged, unmerged,
|
||||||
bins, large, huge);
|
bins, large, huge);
|
||||||
|
Loading…
Reference in New Issue
Block a user