Print merged arena stats iff multiple arenas.
This commit is contained in:
parent
41631d0061
commit
68ddb6736d
@ -320,6 +320,7 @@ stats_print(void (*write4)(void *, const char *, const char *, const char *,
|
|||||||
huge_nmalloc, huge_ndalloc, huge_allocated);
|
huge_nmalloc, huge_ndalloc, huge_allocated);
|
||||||
|
|
||||||
if (merged) {
|
if (merged) {
|
||||||
|
unsigned nmerged;
|
||||||
size_t nactive, ndirty;
|
size_t nactive, ndirty;
|
||||||
arena_stats_t astats;
|
arena_stats_t astats;
|
||||||
malloc_bin_stats_t bstats[nbins];
|
malloc_bin_stats_t bstats[nbins];
|
||||||
@ -333,21 +334,29 @@ stats_print(void (*write4)(void *, const char *, const char *, const char *,
|
|||||||
memset(lstats, 0, sizeof(lstats));
|
memset(lstats, 0, sizeof(lstats));
|
||||||
|
|
||||||
/* Create merged arena stats. */
|
/* Create merged arena stats. */
|
||||||
for (i = 0; i < narenas; i++) {
|
for (i = nmerged = 0; i < narenas; i++) {
|
||||||
arena = arenas[i];
|
arena = arenas[i];
|
||||||
if (arena != NULL) {
|
if (arena != NULL) {
|
||||||
malloc_mutex_lock(&arena->lock);
|
malloc_mutex_lock(&arena->lock);
|
||||||
arena_stats_merge(arena, &nactive,
|
arena_stats_merge(arena, &nactive,
|
||||||
&ndirty, &astats, bstats, lstats);
|
&ndirty, &astats, bstats, lstats);
|
||||||
malloc_mutex_unlock(&arena->lock);
|
malloc_mutex_unlock(&arena->lock);
|
||||||
|
nmerged++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Print merged arena stats. */
|
|
||||||
malloc_cprintf(write4, w4opaque,
|
if (nmerged > 1) {
|
||||||
"\nMerge arenas stats:\n");
|
/* Print merged arena stats. */
|
||||||
/* arenas[0] is used only for invariant bin settings. */
|
malloc_cprintf(write4, w4opaque,
|
||||||
arena_stats_mprint(arenas[0], nactive, ndirty, &astats,
|
"\nMerge arenas stats:\n");
|
||||||
bstats, lstats, bins, large, write4, w4opaque);
|
/*
|
||||||
|
* arenas[0] is used only for invariant bin
|
||||||
|
* settings.
|
||||||
|
*/
|
||||||
|
arena_stats_mprint(arenas[0], nactive, ndirty,
|
||||||
|
&astats, bstats, lstats, bins, large,
|
||||||
|
write4, w4opaque);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (unmerged) {
|
if (unmerged) {
|
||||||
|
Loading…
Reference in New Issue
Block a user