зеркало из https://github.com/github/ruby.git
add debug counters more.
* debug_counter.h: add debug counters to count frame state transitions: * frame_R2R: Ruby frame to Ruby frame * frame_R2C: Ruby frame to C frame * frame_C2C: C frame to C frame * frame_C2R: C frame to Ruby frame * vm_insnhelper.c (vm_push_frame): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64871 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
cebd2c4aba
Коммит
aa1023edc4
|
@ -41,6 +41,11 @@ RB_DEBUG_COUNTER(mc_search_super)
|
||||||
* control frame push counts.
|
* control frame push counts.
|
||||||
*
|
*
|
||||||
* * frame_push: frame push counts.
|
* * frame_push: frame push counts.
|
||||||
|
* * frame_push_*: frame push counts per each type.
|
||||||
|
* * frame_R2R: Ruby frame to Ruby frame
|
||||||
|
* * frame_R2C: Ruby frame to C frame
|
||||||
|
* * frame_C2C: C frame to C frame
|
||||||
|
* * frame_C2R: C frame to Ruby frame
|
||||||
*/
|
*/
|
||||||
RB_DEBUG_COUNTER(frame_push)
|
RB_DEBUG_COUNTER(frame_push)
|
||||||
RB_DEBUG_COUNTER(frame_push_method)
|
RB_DEBUG_COUNTER(frame_push_method)
|
||||||
|
@ -53,6 +58,11 @@ RB_DEBUG_COUNTER(frame_push_eval)
|
||||||
RB_DEBUG_COUNTER(frame_push_rescue)
|
RB_DEBUG_COUNTER(frame_push_rescue)
|
||||||
RB_DEBUG_COUNTER(frame_push_dummy)
|
RB_DEBUG_COUNTER(frame_push_dummy)
|
||||||
|
|
||||||
|
RB_DEBUG_COUNTER(frame_R2R)
|
||||||
|
RB_DEBUG_COUNTER(frame_R2C)
|
||||||
|
RB_DEBUG_COUNTER(frame_C2C)
|
||||||
|
RB_DEBUG_COUNTER(frame_C2R)
|
||||||
|
|
||||||
/* instance variable counts
|
/* instance variable counts
|
||||||
*
|
*
|
||||||
* * ivar_get_ic_hit/miss: ivar_get inline cache (ic) hit/miss counts (VM insn)
|
* * ivar_get_ic_hit/miss: ivar_get inline cache (ic) hit/miss counts (VM insn)
|
||||||
|
|
|
@ -214,21 +214,6 @@ vm_push_frame(rb_execution_context_t *ec,
|
||||||
rb_control_frame_t *const cfp = ec->cfp - 1;
|
rb_control_frame_t *const cfp = ec->cfp - 1;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
#if USE_DEBUG_COUNTER
|
|
||||||
RB_DEBUG_COUNTER_INC(frame_push);
|
|
||||||
switch (type & VM_FRAME_MAGIC_MASK) {
|
|
||||||
case VM_FRAME_MAGIC_METHOD: RB_DEBUG_COUNTER_INC(frame_push_method); break;
|
|
||||||
case VM_FRAME_MAGIC_BLOCK: RB_DEBUG_COUNTER_INC(frame_push_block); break;
|
|
||||||
case VM_FRAME_MAGIC_CLASS: RB_DEBUG_COUNTER_INC(frame_push_class); break;
|
|
||||||
case VM_FRAME_MAGIC_TOP: RB_DEBUG_COUNTER_INC(frame_push_top); break;
|
|
||||||
case VM_FRAME_MAGIC_CFUNC: RB_DEBUG_COUNTER_INC(frame_push_cfunc); break;
|
|
||||||
case VM_FRAME_MAGIC_IFUNC: RB_DEBUG_COUNTER_INC(frame_push_ifunc); break;
|
|
||||||
case VM_FRAME_MAGIC_EVAL: RB_DEBUG_COUNTER_INC(frame_push_eval); break;
|
|
||||||
case VM_FRAME_MAGIC_RESCUE: RB_DEBUG_COUNTER_INC(frame_push_rescue); break;
|
|
||||||
case VM_FRAME_MAGIC_DUMMY: RB_DEBUG_COUNTER_INC(frame_push_dummy); break;
|
|
||||||
default: rb_bug("unreachable");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
vm_check_frame(type, specval, cref_or_me, iseq);
|
vm_check_frame(type, specval, cref_or_me, iseq);
|
||||||
VM_ASSERT(local_size >= 0);
|
VM_ASSERT(local_size >= 0);
|
||||||
|
|
||||||
|
@ -270,6 +255,33 @@ vm_push_frame(rb_execution_context_t *ec,
|
||||||
SDR();
|
SDR();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if USE_DEBUG_COUNTER
|
||||||
|
RB_DEBUG_COUNTER_INC(frame_push);
|
||||||
|
switch (type & VM_FRAME_MAGIC_MASK) {
|
||||||
|
case VM_FRAME_MAGIC_METHOD: RB_DEBUG_COUNTER_INC(frame_push_method); break;
|
||||||
|
case VM_FRAME_MAGIC_BLOCK: RB_DEBUG_COUNTER_INC(frame_push_block); break;
|
||||||
|
case VM_FRAME_MAGIC_CLASS: RB_DEBUG_COUNTER_INC(frame_push_class); break;
|
||||||
|
case VM_FRAME_MAGIC_TOP: RB_DEBUG_COUNTER_INC(frame_push_top); break;
|
||||||
|
case VM_FRAME_MAGIC_CFUNC: RB_DEBUG_COUNTER_INC(frame_push_cfunc); break;
|
||||||
|
case VM_FRAME_MAGIC_IFUNC: RB_DEBUG_COUNTER_INC(frame_push_ifunc); break;
|
||||||
|
case VM_FRAME_MAGIC_EVAL: RB_DEBUG_COUNTER_INC(frame_push_eval); break;
|
||||||
|
case VM_FRAME_MAGIC_RESCUE: RB_DEBUG_COUNTER_INC(frame_push_rescue); break;
|
||||||
|
case VM_FRAME_MAGIC_DUMMY: RB_DEBUG_COUNTER_INC(frame_push_dummy); break;
|
||||||
|
default: rb_bug("unreachable");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
rb_control_frame_t *prev_cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp);
|
||||||
|
int cur_ruby_frame = VM_FRAME_RUBYFRAME_P(cfp);
|
||||||
|
int pre_ruby_frame = VM_FRAME_RUBYFRAME_P(prev_cfp);
|
||||||
|
if (RUBY_VM_END_CONTROL_FRAME(ec) != prev_cfp) {
|
||||||
|
pre_ruby_frame ? (cur_ruby_frame ? RB_DEBUG_COUNTER_INC(frame_R2R) :
|
||||||
|
RB_DEBUG_COUNTER_INC(frame_R2C)):
|
||||||
|
(cur_ruby_frame ? RB_DEBUG_COUNTER_INC(frame_C2R) :
|
||||||
|
RB_DEBUG_COUNTER_INC(frame_C2C));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return cfp;
|
return cfp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче