diff options
| author | Kaushal M <kaushal@redhat.com> | 2012-01-01 15:59:28 +0530 | 
|---|---|---|
| committer | Vijay Bellur <vijay@gluster.com> | 2012-01-27 04:20:04 -0800 | 
| commit | 623919a78a7faac30d1f0df5793681da2c449e32 (patch) | |
| tree | ee213fa96ebf5feb938babf36c34cb7c8d5f6a24 /libglusterfs/src/statedump.c | |
| parent | a078235dbede380ca695251e86a1502ca131d816 (diff) | |
cli: Extend "volume status" with statedump info
This patch enhances and extends the "volume status" command with information
obtained from the statedump of the bricks of volumes.
Adds new status types : clients, inode, fd, mem, callpool
The new syntax of "volume status" is,
 #gluster volume status [all|{<volname> [<brickname>]
                         [misc-details|clients|inode|fd|mem|callpool]}]
Change-Id: I8d019718465bbc3de727653a839de7238f45da5c
BUG: 765495
Signed-off-by: Kaushal M <kaushal@redhat.com>
Reviewed-on: http://review.gluster.com/2637
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Krishnan Parthasarathi <kp@gluster.com>
Diffstat (limited to 'libglusterfs/src/statedump.c')
| -rw-r--r-- | libglusterfs/src/statedump.c | 110 | 
1 files changed, 110 insertions, 0 deletions
diff --git a/libglusterfs/src/statedump.c b/libglusterfs/src/statedump.c index c744c6c5ff8..8c6fe92158d 100644 --- a/libglusterfs/src/statedump.c +++ b/libglusterfs/src/statedump.c @@ -235,6 +235,61 @@ gf_proc_dump_mem_info ()  }  void +gf_proc_dump_mem_info_to_dict (dict_t *dict) +{ +        if (!dict) +                return; +#ifdef HAVE_MALLOC_STATS +        struct  mallinfo info; +        int     ret = -1; + +        memset (&info, 0, sizeof(struct mallinfo)); +        info = mallinfo (); + +        ret = dict_set_int32 (dict, "mallinfo.arena", info.arena); +        if (ret) +                return; + +        ret = dict_set_int32 (dict, "mallinfo.ordblks", info.ordblks); +        if (ret) +                return; + +        ret = dict_set_int32 (dict, "mallinfo.smblks", info.smblks); +        if (ret) +                return; + +        ret = dict_set_int32 (dict, "mallinfo.hblks", info.hblks); +        if (ret) +                return; + +        ret = dict_set_int32 (dict, "mallinfo.hblkhd", info.hblkhd); +        if (ret) +                return; + +        ret = dict_set_int32 (dict, "mallinfo.usmblks", info.usmblks); +        if (ret) +                return; + +        ret = dict_set_int32 (dict, "mallinfo.fsmblks", info.fsmblks); +        if (ret) +                return; + +        ret = dict_set_int32 (dict, "mallinfo.uordblks", info.uordblks); +        if (ret) +                return; + +        ret = dict_set_int32 (dict, "mallinfo.fordblks", info.fordblks); +        if (ret) +                return; + +        ret = dict_set_int32 (dict, "mallinfo.keepcost", info.keepcost); +        if (ret) +                return; +#endif +        return; +} + +void  gf_proc_dump_mempool_info (glusterfs_ctx_t *ctx)  {          struct mem_pool *pool = NULL; @@ -253,6 +308,61 @@ gf_proc_dump_mempool_info (glusterfs_ctx_t *ctx)          }  } +void +gf_proc_dump_mempool_info_to_dict (glusterfs_ctx_t *ctx, dict_t *dict) +{ +        struct mem_pool *pool = NULL; +        char            key[GF_DUMP_MAX_BUF_LEN] = {0,}; +        int             count = 0; +        int             ret = -1; + +        if (!ctx || !dict) +                return; + +        list_for_each_entry (pool, &ctx->mempool_list, global_list) { +                memset (key, 0, sizeof (key)); +                snprintf (key, sizeof (key), "pool%d.name", count); +                ret = dict_set_str (dict, key, pool->name); +                if (ret) +                        return; + +                memset (key, 0, sizeof (key)); +                snprintf (key, sizeof (key), "pool%d.hotcount", count); +                ret = dict_set_int32 (dict, key, pool->hot_count); +                if (ret) +                        return; + +                memset (key, 0, sizeof (key)); +                snprintf (key, sizeof (key), "pool%d.coldcount", count); +                ret = dict_set_int32 (dict, key, pool->cold_count); +                if (ret) +                        return; + +                memset (key, 0, sizeof (key)); +                snprintf (key, sizeof (key), "pool%d.paddedsizeof", count); +                ret = dict_set_uint64 (dict, key, pool->padded_sizeof_type); +                if (ret) +                        return; + +                memset (key, 0, sizeof (key)); +                snprintf (key, sizeof (key), "pool%d.alloccount", count); +                ret = dict_set_uint64 (dict, key, pool->alloc_count); +                if (ret) +                        return; + +                memset (key, 0, sizeof (key)); +                snprintf (key, sizeof (key), "pool%d.max_alloc", count); +                ret = dict_set_int32 (dict, key, pool->max_alloc); +                if (ret) +                        return; + +                count++; +        } +        ret = dict_set_int32 (dict, "mempool-count", count); + +        return; +} +  void gf_proc_dump_latency_info (xlator_t *xl);  void  | 
