diff options
author | tmm1 <tmm1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-12-09 22:50:44 +0000 |
---|---|---|
committer | tmm1 <tmm1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-12-09 22:50:44 +0000 |
commit | 4092574257645118e98224318b89cf80fd18a144 (patch) | |
tree | f3c24a7575d69f879ea19621ab45ea95f7a9c3f2 /vm_method.c | |
parent | 4f7c10f06fcb6c045f12c4384bb92728db97a38a (diff) |
vm_method.c: add new ruby::method-cache-clear dtrace probe
* vm_method.c (rb_clear_method_cache_by_class): fire
ruby::method-cache-clear probe on global or klass-level method cache
clear [Bug #9190]
* probes.d (provider ruby): new dtrace probe
* doc/dtrace_probes.rdoc: docs for new probe
* test/dtrace/test_method_cache.rb: test for new probe
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44103 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_method.c')
-rw-r--r-- | vm_method.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/vm_method.c b/vm_method.c index a7aa496c95..0b707975bf 100644 --- a/vm_method.c +++ b/vm_method.c @@ -61,7 +61,13 @@ void rb_clear_method_cache_by_class(VALUE klass) { if (klass && klass != Qundef) { - if (klass == rb_cBasicObject || klass == rb_cObject || klass == rb_mKernel) { + int global = klass == rb_cBasicObject || klass == rb_cObject || klass == rb_mKernel; + + if (RUBY_DTRACE_METHOD_CACHE_CLEAR_ENABLED()) { + RUBY_DTRACE_METHOD_CACHE_CLEAR(global ? "global" : rb_class2name(klass), rb_sourcefile(), rb_sourceline()); + } + + if (global) { INC_GLOBAL_METHOD_STATE(); } else { |