forked from ruby/ruby
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 ruby#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
- Loading branch information
Showing
5 changed files
with
61 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
require_relative 'helper' | ||
|
||
module DTrace | ||
class TestMethodCacheClear < TestCase | ||
def test_method_cache_clear | ||
trap_probe(probe, <<-code) do |_,rbfile,lines| | ||
class String; end | ||
class String; def abc() end end | ||
class Object; def abc() end end | ||
code | ||
assert_not_includes lines, "String #{rbfile} 1\n" | ||
assert_includes lines, "String #{rbfile} 2\n" | ||
assert_includes lines, "global #{rbfile} 3\n" | ||
end | ||
end | ||
|
||
private | ||
def probe | ||
<<-eoprobe | ||
ruby$target:::method-cache-clear | ||
/arg1/ | ||
{ | ||
printf("%s %s %d\\n", copyinstr(arg0), copyinstr(arg1), arg2); | ||
} | ||
eoprobe | ||
end | ||
end | ||
end if defined?(DTrace::TestCase) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters