stack: make process state dump more debug friendly
store points of stack wind and unwind (function names) for each frame and dump them in process state dump Signed-off-by: Anand Avati <avati@gluster.com> BUG: 1059 (enhancements for getting statistics from performance translators) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1059
This commit is contained in:
parent
50001216d2
commit
4c81f6268d
@ -76,6 +76,22 @@ gf_proc_dump_call_frame (call_frame_t *call_frame, const char *key_buf,...)
|
||||
gf_proc_dump_build_key(key, prefix,"parent");
|
||||
gf_proc_dump_write(key, "%s", my_frame.parent->this->name);
|
||||
}
|
||||
if (my_frame.wind_from) {
|
||||
gf_proc_dump_build_key(key, prefix, "wind_from");
|
||||
gf_proc_dump_write(key, "%s", my_frame.wind_from);
|
||||
}
|
||||
if (my_frame.wind_to) {
|
||||
gf_proc_dump_build_key(key, prefix, "wind_to");
|
||||
gf_proc_dump_write(key, "%s", my_frame.wind_to);
|
||||
}
|
||||
if (my_frame.unwind_from) {
|
||||
gf_proc_dump_build_key(key, prefix, "unwind_from");
|
||||
gf_proc_dump_write(key, "%s", my_frame.unwind_from);
|
||||
}
|
||||
if (my_frame.unwind_to) {
|
||||
gf_proc_dump_build_key(key, prefix, "unwind_to");
|
||||
gf_proc_dump_write(key, "%s", my_frame.unwind_to);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -83,6 +83,10 @@ struct _call_frame_t {
|
||||
glusterfs_fop_t op;
|
||||
struct timeval begin; /* when this frame was created */
|
||||
struct timeval end; /* when this frame completed */
|
||||
const char *wind_from;
|
||||
const char *wind_to;
|
||||
const char *unwind_from;
|
||||
const char *unwind_to;
|
||||
};
|
||||
|
||||
struct _call_stack_t {
|
||||
@ -223,6 +227,9 @@ STACK_DESTROY (call_stack_t *stack)
|
||||
_new->parent = frame; \
|
||||
_new->cookie = _new; \
|
||||
LOCK_INIT (&_new->lock); \
|
||||
_new->wind_from = __FUNCTION__; \
|
||||
_new->wind_to = #fn; \
|
||||
_new->unwind_to = #rfn; \
|
||||
frame->ref_count++; \
|
||||
old_THIS = THIS; \
|
||||
THIS = obj; \
|
||||
@ -254,6 +261,9 @@ STACK_DESTROY (call_stack_t *stack)
|
||||
_new->parent = frame; \
|
||||
_new->cookie = cky; \
|
||||
LOCK_INIT (&_new->lock); \
|
||||
_new->wind_from = __FUNCTION__; \
|
||||
_new->wind_to = #fn; \
|
||||
_new->unwind_to = #rfn; \
|
||||
frame->ref_count++; \
|
||||
fn##_cbk = rfn; \
|
||||
old_THIS = THIS; \
|
||||
@ -279,6 +289,7 @@ STACK_DESTROY (call_stack_t *stack)
|
||||
old_THIS = THIS; \
|
||||
THIS = _parent->this; \
|
||||
frame->complete = _gf_true; \
|
||||
frame->unwind_from = __FUNCTION__; \
|
||||
fn (_parent, frame->cookie, _parent->this, params); \
|
||||
THIS = old_THIS; \
|
||||
} while (0)
|
||||
@ -301,6 +312,7 @@ STACK_DESTROY (call_stack_t *stack)
|
||||
old_THIS = THIS; \
|
||||
THIS = _parent->this; \
|
||||
frame->complete = _gf_true; \
|
||||
frame->unwind_from = __FUNCTION__; \
|
||||
fn (_parent, frame->cookie, _parent->this, params); \
|
||||
THIS = old_THIS; \
|
||||
} while (0)
|
||||
@ -327,6 +339,8 @@ copy_frame (call_frame_t *frame)
|
||||
newstack->gid = oldstack->gid;
|
||||
newstack->pid = oldstack->pid;
|
||||
newstack->ngrps = oldstack->ngrps;
|
||||
newstack->op = oldstack->op;
|
||||
newstack->type = oldstack->type;
|
||||
memcpy (newstack->groups, oldstack->groups,
|
||||
sizeof (uint32_t) * GF_REQUEST_MAXGROUPS);
|
||||
newstack->unique = oldstack->unique;
|
||||
|
Loading…
x
Reference in New Issue
Block a user