diff options
author | Amar Tumballi <amarts@redhat.com> | 2017-09-12 23:01:46 +0530 |
---|---|---|
committer | Xavier Hernandez <jahernan@redhat.com> | 2017-11-08 08:33:22 +0000 |
commit | b79f29694165a65666d4177619d57b54641e4255 (patch) | |
tree | 13022c58cf0e13f4e3823776634086b93994e839 /libglusterfs/src/xlator.c | |
parent | d109c7b79e15ab1940cd083636e867b1d4ed204e (diff) |
xlator: add more metrics per fops
Make sure to handle these counters in STACK_WIND/UNWIND macro, and
keep the counters as part of xlator_t structure itself, to provide
infra to monitoring.
Updates #137
Change-Id: Ib54d45e2321c2b095dac5810c37e6cdffe1f71b7
Signed-off-by: Amar Tumballi <amarts@redhat.com>
Diffstat (limited to 'libglusterfs/src/xlator.c')
-rw-r--r-- | libglusterfs/src/xlator.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c index 4817da43da1..e371038f2c7 100644 --- a/libglusterfs/src/xlator.c +++ b/libglusterfs/src/xlator.c @@ -495,10 +495,22 @@ __xlator_init(xlator_t *xl) { xlator_t *old_THIS = NULL; int ret = 0; + int fop_idx = 0; old_THIS = THIS; THIS = xl; + /* initialize the metrics related locks */ + for (fop_idx = 0; fop_idx < GF_FOP_MAXVALUE; fop_idx++) { + GF_ATOMIC_INIT (xl->stats.total.metrics[fop_idx].fop, 0); + GF_ATOMIC_INIT (xl->stats.total.metrics[fop_idx].cbk, 0); + + GF_ATOMIC_INIT (xl->stats.interval.metrics[fop_idx].fop, 0); + GF_ATOMIC_INIT (xl->stats.interval.metrics[fop_idx].cbk, 0); + } + GF_ATOMIC_INIT (xl->stats.total.count, 0); + GF_ATOMIC_INIT (xl->stats.interval.count, 0); + xlator_init_lock (); ret = xl->init (xl); xlator_init_unlock (); |