diff options
author | Amar Tumballi <amarts@redhat.com> | 2012-02-23 12:53:19 +0530 |
---|---|---|
committer | Vijay Bellur <vijay@gluster.com> | 2012-02-27 02:18:35 -0800 |
commit | a3f6b0c4f231ccdb727227c9c35816b4823cef90 (patch) | |
tree | a0594eedbca1c88fa56bf4f9c172152a77263ae8 /libglusterfs/src | |
parent | 85471322df9676cc344cc2b03627c02ed90da3cd (diff) |
mempool: add more counters to understand the usage scenarios properly
current design of mempool is to fallback to standard calloc/free if
all the buffers in pool are exhausted. Understanding more about those
numbers will help us to tune mempool parameters properly over time.
Change-Id: I2c94373186f7c6a486caff2611c2d9df2c37db3c
Signed-off-by: Amar Tumballi <amarts@redhat.com>
BUG: 797730
Reviewed-on: http://review.gluster.com/2804
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Kaushal M <kaushal@redhat.com>
Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'libglusterfs/src')
-rw-r--r-- | libglusterfs/src/mem-pool.c | 5 | ||||
-rw-r--r-- | libglusterfs/src/mem-pool.h | 3 | ||||
-rw-r--r-- | libglusterfs/src/statedump.c | 14 |
3 files changed, 22 insertions, 0 deletions
diff --git a/libglusterfs/src/mem-pool.c b/libglusterfs/src/mem-pool.c index 2662dc70ab5..0cfd8bd712a 100644 --- a/libglusterfs/src/mem-pool.c +++ b/libglusterfs/src/mem-pool.c @@ -451,6 +451,10 @@ mem_get (struct mem_pool *mem_pool) * because it is too much work knowing that a better slab * allocator is coming RSN. */ + mem_pool->pool_misses++; + mem_pool->curr_stdalloc++; + if (mem_pool->max_stdalloc < mem_pool->curr_stdalloc) + mem_pool->max_stdalloc = mem_pool->curr_stdalloc; ptr = GF_CALLOC (1, mem_pool->padded_sizeof_type, gf_common_mt_mem_pool); gf_log_callingfn ("mem-pool", GF_LOG_DEBUG, "Mem pool is full. " @@ -553,6 +557,7 @@ mem_put (void *ptr) * not have enough info to distinguish between the two * situations. */ + pool->curr_stdalloc--; GF_FREE (list); break; default: diff --git a/libglusterfs/src/mem-pool.h b/libglusterfs/src/mem-pool.h index b9255eae930..2b1cba0ce74 100644 --- a/libglusterfs/src/mem-pool.h +++ b/libglusterfs/src/mem-pool.h @@ -147,7 +147,10 @@ struct mem_pool { void *pool_end; int real_sizeof_type; uint64_t alloc_count; + uint64_t pool_misses; int max_alloc; + int curr_stdalloc; + int max_stdalloc; char *name; struct list_head global_list; }; diff --git a/libglusterfs/src/statedump.c b/libglusterfs/src/statedump.c index dbbccdb44c3..9b15c5ba50d 100644 --- a/libglusterfs/src/statedump.c +++ b/libglusterfs/src/statedump.c @@ -305,6 +305,9 @@ gf_proc_dump_mempool_info (glusterfs_ctx_t *ctx) pool->padded_sizeof_type); gf_proc_dump_write ("alloc-count", "%"PRIu64, pool->alloc_count); gf_proc_dump_write ("max-alloc", "%d", pool->max_alloc); + + gf_proc_dump_write ("pool-misses", "%"PRIu64, pool->pool_misses); + gf_proc_dump_write ("max-stdalloc", "%d", pool->max_stdalloc); } } @@ -356,6 +359,17 @@ gf_proc_dump_mempool_info_to_dict (glusterfs_ctx_t *ctx, dict_t *dict) if (ret) return; + memset (key, 0, sizeof (key)); + snprintf (key, sizeof (key), "pool%d.max-stdalloc", count); + ret = dict_set_int32 (dict, key, pool->max_stdalloc); + if (ret) + return; + + memset (key, 0, sizeof (key)); + snprintf (key, sizeof (key), "pool%d.pool-misses", count); + ret = dict_set_uint64 (dict, key, pool->pool_misses); + if (ret) + return; count++; } ret = dict_set_int32 (dict, "mempool-count", count); |