summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/stack.h
diff options
context:
space:
mode:
authorAmar Tumballi <amarts@redhat.com>2017-09-12 23:01:46 +0530
committerXavier Hernandez <jahernan@redhat.com>2017-11-08 08:33:22 +0000
commitb79f29694165a65666d4177619d57b54641e4255 (patch)
tree13022c58cf0e13f4e3823776634086b93994e839 /libglusterfs/src/stack.h
parentd109c7b79e15ab1940cd083636e867b1d4ed204e (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/stack.h')
-rw-r--r--libglusterfs/src/stack.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/libglusterfs/src/stack.h b/libglusterfs/src/stack.h
index 8a617377bc7..ac395fcc4b0 100644
--- a/libglusterfs/src/stack.h
+++ b/libglusterfs/src/stack.h
@@ -56,6 +56,7 @@ struct call_pool {
} all_stacks;
};
int64_t cnt;
+ gf_atomic_t total_count;
gf_lock_t lock;
struct mem_pool *frame_mem_pool;
struct mem_pool *stack_mem_pool;
@@ -253,6 +254,14 @@ STACK_RESET (call_stack_t *stack)
"winding from %s to %s", \
frame->root, old_THIS->name, \
THIS->name); \
+ /* Need to capture counts at leaf node */ \
+ if (!next_xl->children) { \
+ int op = get_fop_index_from_fn((next_xl), (fn)); \
+ GF_ATOMIC_INC (next_xl->stats.total.metrics[op].fop); \
+ GF_ATOMIC_INC (next_xl->stats.interval.metrics[op].fop); \
+ GF_ATOMIC_INC (next_xl->stats.total.count); \
+ GF_ATOMIC_INC (next_xl->stats.interval.count); \
+ } \
next_xl_fn (frame, next_xl, params); \
THIS = old_THIS; \
} while (0)
@@ -309,6 +318,10 @@ STACK_RESET (call_stack_t *stack)
if (obj->ctx->measure_latency) \
timespec_now (&_new->begin); \
_new->op = get_fop_index_from_fn ((_new->this), (fn)); \
+ GF_ATOMIC_INC (obj->stats.total.metrics[_new->op].fop); \
+ GF_ATOMIC_INC (obj->stats.interval.metrics[_new->op].fop); \
+ GF_ATOMIC_INC (obj->stats.total.count); \
+ GF_ATOMIC_INC (obj->stats.interval.count); \
fn (_new, obj, params); \
THIS = old_THIS; \
} while (0)
@@ -367,6 +380,10 @@ STACK_RESET (call_stack_t *stack)
if (_parent->ret == NULL) \
timespec_now (&_parent->end); \
} \
+ if (op_ret < 0) { \
+ GF_ATOMIC_INC (THIS->stats.total.metrics[frame->op].cbk); \
+ GF_ATOMIC_INC (THIS->stats.interval.metrics[frame->op].cbk); \
+ } \
fn (_parent, frame->cookie, _parent->this, op_ret, \
op_errno, params); \
THIS = old_THIS; \
@@ -485,6 +502,7 @@ copy_frame (call_frame_t *frame)
newstack->pool->cnt++;
}
UNLOCK (&oldstack->pool->lock);
+ GF_ATOMIC_INC (newstack->pool->total_count);
return newframe;
}