summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/statedump.c
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2011-09-19 13:01:26 +0530
committerVijay Bellur <vijay@gluster.com>2011-09-22 04:33:40 -0700
commitb8f2f460f9a5f977ef6debc2e59cae75324c95ca (patch)
tree0df971a6d3838ed4c9abd939822bdb57cda60f7f /libglusterfs/src/statedump.c
parent5619b2dc4189e9de4a2327dc63ccb647f863f2b1 (diff)
statedump: add more memory accounting related stats
* iobuf: add variable to keep count of total number of allocations * iobuf: include 'purged' and 'filled' arenas also in dump * mempool: more details added (with a name to tell why mem-pool is created) * memory-accounting: print number of allocs in each type this would give us much better understanding of the memory allocation pattern Change-Id: I117ac0c1da943a4cc91543a01963ba7940db2b5f BUG: 3567 Reviewed-on: http://review.gluster.com/376 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'libglusterfs/src/statedump.c')
-rw-r--r--libglusterfs/src/statedump.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/libglusterfs/src/statedump.c b/libglusterfs/src/statedump.c
index 57447c4d9f2..b76c9a562dc 100644
--- a/libglusterfs/src/statedump.c
+++ b/libglusterfs/src/statedump.c
@@ -169,6 +169,8 @@ gf_proc_dump_xlator_mem_info (xlator_t *xl)
gf_proc_dump_write (key, "%u", xl->mem_acct.rec[i].max_size);
gf_proc_dump_build_key (key, prefix, "max_num_allocs");
gf_proc_dump_write (key, "%u", xl->mem_acct.rec[i].max_num_allocs);
+ gf_proc_dump_build_key (key, prefix, "total_allocs");
+ gf_proc_dump_write (key, "%u", xl->mem_acct.rec[i].total_allocs);
}
return;
@@ -202,6 +204,25 @@ gf_proc_dump_mem_info ()
}
+void
+gf_proc_dump_mempool_info (glusterfs_ctx_t *ctx)
+{
+ struct mem_pool *pool = NULL;
+
+ gf_proc_dump_add_section ("mempool");
+
+ list_for_each_entry (pool, &ctx->mempool_list, global_list) {
+ gf_proc_dump_write ("-----", "-----");
+ gf_proc_dump_write ("pool-name", "%s", pool->name);
+ gf_proc_dump_write ("hot-count", "%d", pool->hot_count);
+ gf_proc_dump_write ("cold-count", "%d", pool->cold_count);
+ gf_proc_dump_write ("padded_sizeof", "%lu",
+ pool->padded_sizeof_type);
+ gf_proc_dump_write ("alloc-count", "%"PRIu64, pool->alloc_count);
+ gf_proc_dump_write ("max-alloc", "%d", pool->max_alloc);
+ }
+}
+
void gf_proc_dump_latency_info (xlator_t *xl);
void
@@ -422,11 +443,13 @@ gf_proc_dump_info (int signum)
if (ret < 0)
goto out;
- if (GF_PROC_DUMP_IS_OPTION_ENABLED (mem))
- gf_proc_dump_mem_info ();
-
ctx = glusterfs_ctx_get ();
+ if (GF_PROC_DUMP_IS_OPTION_ENABLED (mem)) {
+ gf_proc_dump_mem_info ();
+ gf_proc_dump_mempool_info (ctx);
+ }
+
if (ctx) {
if (GF_PROC_DUMP_IS_OPTION_ENABLED (iobuf))
iobuf_stats_dump (ctx->iobuf_pool);