From b8f2f460f9a5f977ef6debc2e59cae75324c95ca Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Mon, 19 Sep 2011 13:01:26 +0530 Subject: 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 Reviewed-by: Vijay Bellur --- libglusterfs/src/statedump.c | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) (limited to 'libglusterfs/src/statedump.c') diff --git a/libglusterfs/src/statedump.c b/libglusterfs/src/statedump.c index 57447c4d..b76c9a56 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); -- cgit