summaryrefslogtreecommitdiffstats
path: root/jemalloc
diff options
context:
space:
mode:
authorJason Evans <jasone@canonware.com>2010-01-25 01:21:47 (GMT)
committerJason Evans <jasone@canonware.com>2010-01-25 01:21:47 (GMT)
commit68ddb6736db319f6714547f2828777399595657e (patch)
tree54bdd58b3eac91730a9d2fd109df2ac334b6f244 /jemalloc
parent41631d00618d7262125e501c91d31b4d70e605fa (diff)
downloadjemalloc-68ddb6736db319f6714547f2828777399595657e.zip
jemalloc-68ddb6736db319f6714547f2828777399595657e.tar.gz
jemalloc-68ddb6736db319f6714547f2828777399595657e.tar.bz2
Print merged arena stats iff multiple arenas.
Diffstat (limited to 'jemalloc')
-rw-r--r--jemalloc/src/jemalloc_stats.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/jemalloc/src/jemalloc_stats.c b/jemalloc/src/jemalloc_stats.c
index a70cb57..d1c4ab5 100644
--- a/jemalloc/src/jemalloc_stats.c
+++ b/jemalloc/src/jemalloc_stats.c
@@ -320,6 +320,7 @@ stats_print(void (*write4)(void *, const char *, const char *, const char *,
huge_nmalloc, huge_ndalloc, huge_allocated);
if (merged) {
+ unsigned nmerged;
size_t nactive, ndirty;
arena_stats_t astats;
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));
/* Create merged arena stats. */
- for (i = 0; i < narenas; i++) {
+ for (i = nmerged = 0; i < narenas; i++) {
arena = arenas[i];
if (arena != NULL) {
malloc_mutex_lock(&arena->lock);
arena_stats_merge(arena, &nactive,
&ndirty, &astats, bstats, lstats);
malloc_mutex_unlock(&arena->lock);
+ nmerged++;
}
}
- /* Print merged arena stats. */
- malloc_cprintf(write4, w4opaque,
- "\nMerge arenas stats:\n");
- /* arenas[0] is used only for invariant bin settings. */
- arena_stats_mprint(arenas[0], nactive, ndirty, &astats,
- bstats, lstats, bins, large, write4, w4opaque);
+
+ if (nmerged > 1) {
+ /* Print merged arena stats. */
+ malloc_cprintf(write4, w4opaque,
+ "\nMerge arenas stats:\n");
+ /*
+ * 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) {