summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiels de Vos <ndevos@redhat.com>2017-08-06 17:21:51 +0200
committerJeff Darcy <jeff@pl.atyp.us>2017-08-28 12:40:33 +0000
commitc96cb9fc28e4358c5d7246ce77b676113a63ce85 (patch)
tree0757f42a8b5d89d436921c80d66943b2d295a5c2
parent414d3e92fc56f08e320a3aa65b6b18e65b384551 (diff)
statedump: add support for dumping basic mem-pool info
With all the new 'struct mem_pool' infrastructure in place, it is now possible to fetch details about the memory pools that a glusterfs_ctx_t uses. This only captures the information from 'struct mem_pool', and not from the global 'struct mem_pool_shared' or the pool_sweeper thread. The current details help with detecting memory leaks. Updates: #307 Change-Id: Idbc5ba136df50863e1e380b448061509896f2c23 Signed-off-by: Niels de Vos <ndevos@redhat.com> Reviewed-on: https://review.gluster.org/18076 Smoke: Gluster Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Amar Tumballi <amarts@redhat.com>
-rw-r--r--libglusterfs/src/statedump.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/libglusterfs/src/statedump.c b/libglusterfs/src/statedump.c
index 697ddc3b7ba..a2000b158e6 100644
--- a/libglusterfs/src/statedump.c
+++ b/libglusterfs/src/statedump.c
@@ -376,11 +376,11 @@ gf_proc_dump_mem_info_to_dict (dict_t *dict)
void
gf_proc_dump_mempool_info (glusterfs_ctx_t *ctx)
{
-#if defined(OLD_MEM_POOLS)
struct mem_pool *pool = NULL;
gf_proc_dump_add_section ("mempool");
+#if defined(OLD_MEM_POOLS)
list_for_each_entry (pool, &ctx->mempool_list, global_list) {
gf_proc_dump_write ("-----", "-----");
gf_proc_dump_write ("pool-name", "%s", pool->name);
@@ -395,6 +395,24 @@ gf_proc_dump_mempool_info (glusterfs_ctx_t *ctx)
gf_proc_dump_write ("cur-stdalloc", "%d", pool->curr_stdalloc);
gf_proc_dump_write ("max-stdalloc", "%d", pool->max_stdalloc);
}
+#else
+ LOCK (&ctx->lock);
+ {
+ list_for_each_entry (pool, &ctx->mempool_list, owner) {
+ int64_t active = GF_ATOMIC_GET (pool->active);
+
+ gf_proc_dump_write ("-----", "-----");
+ gf_proc_dump_write ("pool-name", "%s", pool->name);
+ gf_proc_dump_write ("active-count", "%"GF_PRI_ATOMIC, active);
+ gf_proc_dump_write ("sizeof-type", "%d", pool->sizeof_type);
+ gf_proc_dump_write ("padded-sizeof", "%lu", 1 << pool->pool->power_of_two);
+ gf_proc_dump_write ("size", "%lu", (1 << pool->pool->power_of_two) * active);
+ gf_proc_dump_write ("shared-pool", "%p", pool->pool);
+ }
+ }
+ UNLOCK (&ctx->lock);
+
+ /* TODO: details of (struct mem_pool_shared) pool->pool */
#endif
}