зеркало из https://github.com/github/ruby.git
add debug counters for vm_search_method_slowpath()
Implemented fine-grained inspection of cache misshits. Handy for counting the reasons why an inline method cache was evicted.
This commit is contained in:
Родитель
84fc1de512
Коммит
3ffd98c5cd
|
@ -26,6 +26,11 @@
|
||||||
* * mc_cme_complement: callable_method_entry complement counts.
|
* * mc_cme_complement: callable_method_entry complement counts.
|
||||||
* * mc_cme_complement_hit: callable_method_entry cache hit counts.
|
* * mc_cme_complement_hit: callable_method_entry cache hit counts.
|
||||||
* * mc_search_super: search_method() call counts.
|
* * mc_search_super: search_method() call counts.
|
||||||
|
* * mc_miss_by_nome: inline mc miss by no ment.
|
||||||
|
* * mc_miss_by_distinct: ... by distinct ment.
|
||||||
|
* * mc_miss_by_refine: ... by ment being refined.
|
||||||
|
* * mc_miss_by_visi: ... by visibility change.
|
||||||
|
* * mc_miss_spurious: spurious inline mc misshit.
|
||||||
*/
|
*/
|
||||||
RB_DEBUG_COUNTER(mc_inline_hit)
|
RB_DEBUG_COUNTER(mc_inline_hit)
|
||||||
RB_DEBUG_COUNTER(mc_inline_miss)
|
RB_DEBUG_COUNTER(mc_inline_miss)
|
||||||
|
@ -36,6 +41,11 @@ RB_DEBUG_COUNTER(mc_class_serial_miss)
|
||||||
RB_DEBUG_COUNTER(mc_cme_complement)
|
RB_DEBUG_COUNTER(mc_cme_complement)
|
||||||
RB_DEBUG_COUNTER(mc_cme_complement_hit)
|
RB_DEBUG_COUNTER(mc_cme_complement_hit)
|
||||||
RB_DEBUG_COUNTER(mc_search_super)
|
RB_DEBUG_COUNTER(mc_search_super)
|
||||||
|
RB_DEBUG_COUNTER(mc_miss_by_nome)
|
||||||
|
RB_DEBUG_COUNTER(mc_miss_by_distinct)
|
||||||
|
RB_DEBUG_COUNTER(mc_miss_by_refine)
|
||||||
|
RB_DEBUG_COUNTER(mc_miss_by_visi)
|
||||||
|
RB_DEBUG_COUNTER(mc_miss_spurious)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* call cache fastpath usage
|
* call cache fastpath usage
|
||||||
|
|
|
@ -1386,12 +1386,15 @@ static inline vm_call_handler
|
||||||
calccall(const struct rb_call_info *ci, const struct rb_call_cache *cc, const rb_callable_method_entry_t *me)
|
calccall(const struct rb_call_info *ci, const struct rb_call_cache *cc, const rb_callable_method_entry_t *me)
|
||||||
{
|
{
|
||||||
if (UNLIKELY(!me)) {
|
if (UNLIKELY(!me)) {
|
||||||
|
RB_DEBUG_COUNTER_INC(mc_miss_by_nome);
|
||||||
return vm_call_general; /* vm_call_method_nome() situation */
|
return vm_call_general; /* vm_call_method_nome() situation */
|
||||||
}
|
}
|
||||||
else if (LIKELY(cc->me != me)) {
|
else if (LIKELY(cc->me != me)) {
|
||||||
|
RB_DEBUG_COUNTER_INC(mc_miss_by_distinct);
|
||||||
return vm_call_general; /* normal cases */
|
return vm_call_general; /* normal cases */
|
||||||
}
|
}
|
||||||
else if (UNLIKELY(cc->def != me->def)) {
|
else if (UNLIKELY(cc->def != me->def)) {
|
||||||
|
RB_DEBUG_COUNTER_INC(mc_miss_by_refine);
|
||||||
return vm_call_general; /* cc->me was refined elsewhere */
|
return vm_call_general; /* cc->me was refined elsewhere */
|
||||||
}
|
}
|
||||||
/* "Calling a formerly-public method, which is now privatised, with an
|
/* "Calling a formerly-public method, which is now privatised, with an
|
||||||
|
@ -1400,9 +1403,11 @@ calccall(const struct rb_call_info *ci, const struct rb_call_cache *cc, const rb
|
||||||
* Calling a private method without specifying a receiver is also safe. */
|
* Calling a private method without specifying a receiver is also safe. */
|
||||||
else if ((METHOD_ENTRY_VISI(cc->me) != METHOD_VISI_PUBLIC) &&
|
else if ((METHOD_ENTRY_VISI(cc->me) != METHOD_VISI_PUBLIC) &&
|
||||||
!(ci->flag & VM_CALL_FCALL)) {
|
!(ci->flag & VM_CALL_FCALL)) {
|
||||||
|
RB_DEBUG_COUNTER_INC(mc_miss_by_visi);
|
||||||
return vm_call_general;
|
return vm_call_general;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
RB_DEBUG_COUNTER_INC(mc_miss_spurious);
|
||||||
return cc->call;
|
return cc->call;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче