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.
This commit is contained in:
parent
0d20eda127
commit
8076b28721
17
src/stats.c
17
src/stats.c
@ -923,9 +923,16 @@ MUTEX_PROF_COUNTERS
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
stats_print_helper(void (*write_cb)(void *, const char *), void *cbopaque,
|
stats_print_helper(emitter_t *emitter, bool merged, bool destroyed,
|
||||||
bool json, bool merged, bool destroyed, bool unmerged, bool bins,
|
bool unmerged, bool bins, bool large, bool mutex) {
|
||||||
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,
|
size_t allocated, active, metadata, metadata_thp, resident, mapped,
|
||||||
retained;
|
retained;
|
||||||
size_t num_background_threads;
|
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");
|
malloc_cprintf(write_cb, cbopaque, "\n");
|
||||||
}
|
}
|
||||||
if (config_stats) {
|
if (config_stats) {
|
||||||
stats_print_helper(write_cb, cbopaque, json, merged, destroyed,
|
stats_print_helper(&emitter, merged, destroyed, unmerged,
|
||||||
unmerged, bins, large, mutex);
|
bins, large, mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
emitter_json_dict_end(&emitter); /* Closes the "jemalloc" dict. */
|
emitter_json_dict_end(&emitter); /* Closes the "jemalloc" dict. */
|
||||||
|
Loading…
Reference in New Issue
Block a user