ruby-prof 1.1.0-x64-mingw32 → 1.4.2-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES +48 -1
  3. data/Rakefile +2 -14
  4. data/bin/ruby-prof +100 -152
  5. data/ext/ruby_prof/extconf.rb +8 -28
  6. data/ext/ruby_prof/rp_aggregate_call_tree.c +59 -0
  7. data/ext/ruby_prof/rp_aggregate_call_tree.h +13 -0
  8. data/ext/ruby_prof/rp_allocation.c +67 -59
  9. data/ext/ruby_prof/rp_allocation.h +3 -3
  10. data/ext/ruby_prof/rp_call_tree.c +369 -0
  11. data/ext/ruby_prof/rp_call_tree.h +43 -0
  12. data/ext/ruby_prof/rp_call_trees.c +288 -0
  13. data/ext/ruby_prof/rp_call_trees.h +28 -0
  14. data/ext/ruby_prof/rp_measure_allocations.c +12 -14
  15. data/ext/ruby_prof/rp_measure_process_time.c +12 -14
  16. data/ext/ruby_prof/rp_measure_wall_time.c +17 -15
  17. data/ext/ruby_prof/rp_measurement.c +47 -40
  18. data/ext/ruby_prof/rp_measurement.h +7 -7
  19. data/ext/ruby_prof/rp_method.c +116 -255
  20. data/ext/ruby_prof/rp_method.h +31 -39
  21. data/ext/ruby_prof/rp_profile.c +316 -303
  22. data/ext/ruby_prof/rp_profile.h +1 -3
  23. data/ext/ruby_prof/rp_stack.c +122 -106
  24. data/ext/ruby_prof/rp_stack.h +17 -20
  25. data/ext/ruby_prof/rp_thread.c +136 -111
  26. data/ext/ruby_prof/rp_thread.h +12 -9
  27. data/ext/ruby_prof/ruby_prof.c +27 -23
  28. data/ext/ruby_prof/ruby_prof.h +9 -0
  29. data/ext/ruby_prof/vc/ruby_prof.sln +8 -0
  30. data/ext/ruby_prof/vc/ruby_prof.vcxproj +22 -7
  31. data/lib/2.7/ruby_prof.so +0 -0
  32. data/lib/ruby-prof.rb +5 -5
  33. data/lib/ruby-prof/assets/call_stack_printer.html.erb +4 -7
  34. data/lib/ruby-prof/assets/graph_printer.html.erb +5 -6
  35. data/lib/ruby-prof/{call_info.rb → call_tree.rb} +6 -6
  36. data/lib/ruby-prof/call_tree_visitor.rb +36 -0
  37. data/lib/ruby-prof/compatibility.rb +0 -10
  38. data/lib/ruby-prof/measurement.rb +5 -2
  39. data/lib/ruby-prof/method_info.rb +3 -15
  40. data/lib/ruby-prof/printers/abstract_printer.rb +12 -2
  41. data/lib/ruby-prof/printers/call_info_printer.rb +12 -10
  42. data/lib/ruby-prof/printers/call_stack_printer.rb +20 -22
  43. data/lib/ruby-prof/printers/call_tree_printer.rb +1 -1
  44. data/lib/ruby-prof/printers/dot_printer.rb +3 -3
  45. data/lib/ruby-prof/printers/flat_printer.rb +3 -2
  46. data/lib/ruby-prof/printers/graph_printer.rb +4 -5
  47. data/lib/ruby-prof/printers/multi_printer.rb +2 -2
  48. data/lib/ruby-prof/profile.rb +8 -4
  49. data/lib/ruby-prof/rack.rb +51 -127
  50. data/lib/ruby-prof/thread.rb +3 -18
  51. data/lib/ruby-prof/version.rb +1 -1
  52. data/ruby-prof.gemspec +7 -0
  53. data/test/alias_test.rb +42 -45
  54. data/test/basic_test.rb +0 -86
  55. data/test/{call_info_visitor_test.rb → call_tree_visitor_test.rb} +6 -5
  56. data/test/call_trees_test.rb +66 -0
  57. data/test/exclude_methods_test.rb +17 -12
  58. data/test/fiber_test.rb +95 -39
  59. data/test/gc_test.rb +36 -42
  60. data/test/inverse_call_tree_test.rb +175 -0
  61. data/test/line_number_test.rb +67 -70
  62. data/test/marshal_test.rb +7 -13
  63. data/test/measure_allocations_test.rb +224 -234
  64. data/test/measure_allocations_trace_test.rb +224 -234
  65. data/test/measure_memory_trace_test.rb +814 -469
  66. data/test/measure_process_time_test.rb +0 -64
  67. data/test/measure_times.rb +2 -0
  68. data/test/measure_wall_time_test.rb +34 -58
  69. data/test/pause_resume_test.rb +19 -10
  70. data/test/prime.rb +1 -3
  71. data/test/prime_script.rb +6 -0
  72. data/test/printer_call_stack_test.rb +0 -1
  73. data/test/printer_call_tree_test.rb +0 -1
  74. data/test/printer_flat_test.rb +61 -30
  75. data/test/printer_graph_html_test.rb +0 -1
  76. data/test/printer_graph_test.rb +3 -4
  77. data/test/printers_test.rb +2 -2
  78. data/test/printing_recursive_graph_test.rb +1 -1
  79. data/test/profile_test.rb +16 -0
  80. data/test/rack_test.rb +0 -64
  81. data/test/recursive_test.rb +50 -54
  82. data/test/start_stop_test.rb +19 -19
  83. data/test/test_helper.rb +6 -17
  84. data/test/thread_test.rb +11 -11
  85. data/test/unique_call_path_test.rb +25 -95
  86. metadata +22 -11
  87. data/ext/ruby_prof/rp_call_info.c +0 -271
  88. data/ext/ruby_prof/rp_call_info.h +0 -35
  89. data/lib/2.6.5/ruby_prof.so +0 -0
  90. data/lib/ruby-prof/call_info_visitor.rb +0 -38
  91. data/test/parser_timings.rb +0 -24
@@ -1,23 +1,8 @@
1
1
  module RubyProf
2
2
  class Thread
3
- # Returns the root methods (ie, methods that were not called by other methods) that were profiled while
4
- # this thread was executing. Generally there is only one root method (multiple root methods can occur
5
- # when Profile#pause is used). By starting with the root methods, you can descend down the profile
6
- # call tree.
7
- def root_methods
8
- self.methods.select do |method_info|
9
- method_info.root?
10
- end
11
- end
12
-
13
3
  # Returns the total time this thread was executed.
14
4
  def total_time
15
- self.root_methods.inject(0) do |sum, method_info|
16
- method_info.callers.each do |call_info|
17
- sum += call_info.total_time
18
- end
19
- sum
20
- end
5
+ self.call_tree.total_time
21
6
  end
22
7
 
23
8
  # Returns the amount of time this thread waited while other thread executed.
@@ -25,8 +10,8 @@ module RubyProf
25
10
  # wait_time, like self:time, is always method local
26
11
  # thus we need to sum over all methods and call infos
27
12
  self.methods.inject(0) do |sum, method_info|
28
- method_info.callers.each do |call_info|
29
- sum += call_info.wait_time
13
+ method_info.callers.each do |call_tree|
14
+ sum += call_tree.wait_time
30
15
  end
31
16
  sum
32
17
  end
@@ -1,3 +1,3 @@
1
1
  module RubyProf
2
- VERSION = "1.1.0"
2
+ VERSION = "1.4.2"
3
3
  end
@@ -19,6 +19,13 @@ EOF
19
19
  spec.license = 'BSD-2-Clause'
20
20
  spec.version = RubyProf::VERSION
21
21
 
22
+ spec.metadata = {
23
+ "bug_tracker_uri" => "https://github.com/ruby-prof/ruby-prof/issues",
24
+ "changelog_uri" => "https://github.com/ruby-prof/ruby-prof/blob/master/CHANGES",
25
+ "documentation_uri" => "https://ruby-prof.github.io/",
26
+ "source_code_uri" => "https://github.com/ruby-prof/ruby-prof/tree/v#{spec.version}",
27
+ }
28
+
22
29
  spec.author = "Shugo Maeda, Charlie Savage, Roger Pack, Stefan Kaes"
23
30
  spec.email = "shugo@ruby-lang.org, cfis@savagexi.com, rogerdpack@gmail.com, skaes@railsexpress.de"
24
31
  spec.platform = Gem::Platform::RUBY
@@ -37,19 +37,16 @@ class AliasTest < TestCase
37
37
  assert_equal(28, method.line)
38
38
  refute(method.recursive?)
39
39
 
40
- assert_equal(1, method.callers.count)
41
- call_info = method.callers[0]
42
- assert_nil(call_info.parent)
43
- assert_equal(28, call_info.line)
40
+ assert_equal(0, method.call_trees.callers.count)
44
41
 
45
- assert_equal(2, method.callees.count)
46
- call_info = method.callees[0]
47
- assert_equal('Class#new', call_info.target.full_name)
48
- assert_equal(28, call_info.line)
42
+ assert_equal(2, method.call_trees.callees.count)
43
+ call_tree = method.call_trees.callees[0]
44
+ assert_equal('Class#new', call_tree.target.full_name)
45
+ assert_equal(28, call_tree.line)
49
46
 
50
- call_info = method.callees[1]
51
- assert_equal('AliasTest::TestMe#some_method', call_info.target.full_name)
52
- assert_equal(28, call_info.line)
47
+ call_tree = method.call_trees.callees[1]
48
+ assert_equal('AliasTest::TestMe#some_method', call_tree.target.full_name)
49
+ assert_equal(28, call_tree.line)
53
50
 
54
51
  # Method 1
55
52
  method = methods[1]
@@ -57,15 +54,15 @@ class AliasTest < TestCase
57
54
  assert_equal(0, method.line)
58
55
  refute(method.recursive?)
59
56
 
60
- assert_equal(1, method.callers.count)
61
- call_info = method.callers[0]
62
- assert_equal('AliasTest#test_alias', call_info.parent.full_name)
63
- assert_equal(28, call_info.line)
57
+ assert_equal(1, method.call_trees.callers.count)
58
+ call_tree = method.call_trees.callers[0]
59
+ assert_equal('AliasTest#test_alias', call_tree.parent.target.full_name)
60
+ assert_equal(28, call_tree.line)
64
61
 
65
- assert_equal(1, method.callees.count)
66
- call_info = method.callees[0]
67
- assert_equal('BasicObject#initialize', call_info.target.full_name)
68
- assert_equal(0, call_info.line)
62
+ assert_equal(1, method.call_trees.callees.count)
63
+ call_tree = method.call_trees.callees[0]
64
+ assert_equal('BasicObject#initialize', call_tree.target.full_name)
65
+ assert_equal(0, call_tree.line)
69
66
 
70
67
  # Method 2
71
68
  method = methods[2]
@@ -73,12 +70,12 @@ class AliasTest < TestCase
73
70
  assert_equal(0, method.line)
74
71
  refute(method.recursive?)
75
72
 
76
- assert_equal(1, method.callers.count)
77
- call_info = method.callers[0]
78
- assert_equal('Class#new', call_info.parent.full_name)
79
- assert_equal(0, call_info.line)
73
+ assert_equal(1, method.call_trees.callers.count)
74
+ call_tree = method.call_trees.callers[0]
75
+ assert_equal('Class#new', call_tree.parent.target.full_name)
76
+ assert_equal(0, call_tree.line)
80
77
 
81
- assert_equal(0, method.callees.count)
78
+ assert_equal(0, method.call_trees.callees.count)
82
79
 
83
80
  # Method 3
84
81
  method = methods[3]
@@ -86,15 +83,15 @@ class AliasTest < TestCase
86
83
  assert_equal(13, method.line)
87
84
  refute(method.recursive?)
88
85
 
89
- assert_equal(1, method.callers.count)
90
- call_info = method.callers[0]
91
- assert_equal('AliasTest#test_alias', call_info.parent.full_name)
92
- assert_equal(28, call_info.line)
86
+ assert_equal(1, method.call_trees.callers.count)
87
+ call_tree = method.call_trees.callers[0]
88
+ assert_equal('AliasTest#test_alias', call_tree.parent.target.full_name)
89
+ assert_equal(28, call_tree.line)
93
90
 
94
- assert_equal(1, method.callees.count)
95
- call_info = method.callees[0]
96
- assert_equal('AliasTest::TestMe#some_method_original', call_info.target.full_name)
97
- assert_equal(14, call_info.line)
91
+ assert_equal(1, method.call_trees.callees.count)
92
+ call_tree = method.call_trees.callees[0]
93
+ assert_equal('AliasTest::TestMe#some_method_original', call_tree.target.full_name)
94
+ assert_equal(14, call_tree.line)
98
95
 
99
96
  # Method 4
100
97
  method = methods[4]
@@ -102,15 +99,15 @@ class AliasTest < TestCase
102
99
  assert_equal(8, method.line)
103
100
  refute(method.recursive?)
104
101
 
105
- assert_equal(1, method.callers.count)
106
- call_info = method.callers[0]
107
- assert_equal('AliasTest::TestMe#some_method', call_info.parent.full_name)
108
- assert_equal(14, call_info.line)
102
+ assert_equal(1, method.call_trees.callers.count)
103
+ call_tree = method.call_trees.callers[0]
104
+ assert_equal('AliasTest::TestMe#some_method', call_tree.parent.target.full_name)
105
+ assert_equal(14, call_tree.line)
109
106
 
110
- assert_equal(1, method.callees.count)
111
- call_info = method.callees[0]
112
- assert_equal('Kernel#sleep', call_info.target.full_name)
113
- assert_equal(9, call_info.line)
107
+ assert_equal(1, method.call_trees.callees.count)
108
+ call_tree = method.call_trees.callees[0]
109
+ assert_equal('Kernel#sleep', call_tree.target.full_name)
110
+ assert_equal(9, call_tree.line)
114
111
 
115
112
  # Method 5
116
113
  method = methods[5]
@@ -118,12 +115,12 @@ class AliasTest < TestCase
118
115
  assert_equal(0, method.line)
119
116
  refute(method.recursive?)
120
117
 
121
- assert_equal(1, method.callers.count)
122
- call_info = method.callers[0]
123
- assert_equal('AliasTest::TestMe#some_method_original', call_info.parent.full_name)
124
- assert_equal(9, call_info.line)
118
+ assert_equal(1, method.call_trees.callers.count)
119
+ call_tree = method.call_trees.callers[0]
120
+ assert_equal('AliasTest::TestMe#some_method_original', call_tree.parent.target.full_name)
121
+ assert_equal(9, call_tree.line)
125
122
 
126
- assert_equal(0, method.callees.count)
123
+ assert_equal(0, method.call_trees.callees.count)
127
124
  end
128
125
  end
129
126
  end
@@ -10,11 +10,6 @@ class BasicTest < TestCase
10
10
  RubyProf::measure_mode = RubyProf::WALL_TIME
11
11
  end
12
12
 
13
- def start
14
- RubyProf.start
15
- RubyProf::C1.sleep_wait
16
- end
17
-
18
13
  def test_running
19
14
  assert(!RubyProf.running?)
20
15
  RubyProf.start
@@ -45,85 +40,4 @@ class BasicTest < TestCase
45
40
 
46
41
  RubyProf.stop
47
42
  end
48
-
49
- def test_leave_method
50
- start
51
- sleep 0.15
52
- profile = RubyProf.stop
53
-
54
- assert_equal(1, profile.threads.count)
55
-
56
- thread = profile.threads.first
57
- assert_in_delta(0.25, thread.total_time, 0.05)
58
-
59
- root_methods = thread.root_methods.sort
60
- assert_equal(2, root_methods.count)
61
- assert_equal("BasicTest#start", root_methods[0].full_name)
62
- assert_equal("BasicTest#test_leave_method", root_methods[1].full_name)
63
-
64
- assert_equal(4, thread.methods.length)
65
- methods = profile.threads.first.methods.sort
66
-
67
- # Check times
68
- assert_equal("<Class::RubyProf::C1>#sleep_wait", methods[0].full_name)
69
- assert_in_delta(0.1, methods[0].total_time, 0.05)
70
- assert_in_delta(0.0, methods[0].wait_time, 0.05)
71
- assert_in_delta(0.0, methods[0].self_time, 0.05)
72
-
73
- assert_equal("BasicTest#start", methods[1].full_name)
74
- assert_in_delta(0.1, methods[1].total_time, 0.05)
75
- assert_in_delta(0.0, methods[1].wait_time, 0.05)
76
- assert_in_delta(0.0, methods[1].self_time, 0.05)
77
-
78
- assert_equal("BasicTest#test_leave_method", methods[2].full_name)
79
- assert_in_delta(0.15, methods[2].total_time, 0.05)
80
- assert_in_delta(0.0, methods[2].wait_time, 0.05)
81
- assert_in_delta(0.0, methods[2].self_time, 0.05)
82
-
83
- assert_equal("Kernel#sleep", methods[3].full_name)
84
- assert_in_delta(0.25, methods[3].total_time, 0.05)
85
- assert_in_delta(0.0, methods[3].wait_time, 0.05)
86
- assert_in_delta(0.25, methods[3].self_time, 0.05)
87
- end
88
-
89
- def test_leave_method_2
90
- start
91
- RubyProf::C1.sleep_wait
92
- RubyProf::C1.sleep_wait
93
- profile = RubyProf.stop
94
-
95
- assert_equal(1, profile.threads.count)
96
-
97
- thread = profile.threads.first
98
- assert_in_delta(0.3, thread.total_time, 0.05)
99
-
100
- root_methods = thread.root_methods.sort
101
- assert_equal(2, root_methods.count)
102
- assert_equal("BasicTest#start", root_methods[0].full_name)
103
- assert_equal("BasicTest#test_leave_method_2", root_methods[1].full_name)
104
-
105
- assert_equal(4, thread.methods.length)
106
- methods = profile.threads.first.methods.sort
107
-
108
- # Check times
109
- assert_equal("BasicTest#start", methods[0].full_name)
110
- assert_in_delta(0.1, methods[0].total_time, 0.05)
111
- assert_in_delta(0.0, methods[0].wait_time, 0.05)
112
- assert_in_delta(0.0, methods[0].self_time, 0.05)
113
-
114
- assert_equal("BasicTest#test_leave_method_2", methods[1].full_name)
115
- assert_in_delta(0.2, methods[1].total_time, 0.05)
116
- assert_in_delta(0.0, methods[1].wait_time, 0.05)
117
- assert_in_delta(0.0, methods[1].self_time, 0.05)
118
-
119
- assert_equal("Kernel#sleep", methods[2].full_name)
120
- assert_in_delta(0.3, methods[2].total_time, 0.05)
121
- assert_in_delta(0.0, methods[2].wait_time, 0.05)
122
- assert_in_delta(0.3, methods[2].self_time, 0.05)
123
-
124
- assert_equal("<Class::RubyProf::C1>#sleep_wait", methods[3].full_name)
125
- assert_in_delta(0.3, methods[3].total_time, 0.05)
126
- assert_in_delta(0.0, methods[3].wait_time, 0.05)
127
- assert_in_delta(0.0, methods[3].self_time, 0.05)
128
- end
129
43
  end
@@ -2,8 +2,9 @@
2
2
  # encoding: UTF-8
3
3
 
4
4
  require File.expand_path('../test_helper', __FILE__)
5
+ require_relative './measure_times'
5
6
 
6
- class CallInfoVisitorTest < TestCase
7
+ class CallTreeVisitorTest < TestCase
7
8
  def setup
8
9
  # Need to use wall time for this test due to the sleep calls
9
10
  RubyProf::measure_mode = RubyProf::WALL_TIME
@@ -14,16 +15,16 @@ class CallInfoVisitorTest < TestCase
14
15
  RubyProf::C1.sleep_wait
15
16
  end
16
17
 
17
- visitor = RubyProf::CallInfoVisitor.new(result.threads.first.root_methods)
18
+ visitor = RubyProf::CallTreeVisitor.new(result.threads.first.call_tree)
18
19
 
19
20
  method_names = Array.new
20
21
 
21
- visitor.visit do |call_info, event|
22
- method_names << call_info.target.full_name if event == :enter
22
+ visitor.visit do |call_tree, event|
23
+ method_names << call_tree.target.full_name if event == :enter
23
24
  end
24
25
 
25
26
  assert_equal(3, method_names.length)
26
- assert_equal("CallInfoVisitorTest#test_visit", method_names[0])
27
+ assert_equal("CallTreeVisitorTest#test_visit", method_names[0])
27
28
  assert_equal("<Class::RubyProf::C1>#sleep_wait", method_names[1])
28
29
  assert_equal("Kernel#sleep", method_names[2])
29
30
  end
@@ -0,0 +1,66 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: UTF-8
3
+
4
+ require File.expand_path('../test_helper', __FILE__)
5
+
6
+ # -- Tests ----
7
+ class CallTreesTest < TestCase
8
+ def some_method_1
9
+ some_method_2
10
+ end
11
+
12
+ def some_method_2
13
+ end
14
+
15
+ def test_call_infos
16
+ result = RubyProf.profile do
17
+ some_method_1
18
+ end
19
+
20
+ thread = result.threads.first
21
+ assert_equal(3, thread.methods.length)
22
+
23
+ method = thread.methods[0]
24
+ assert_equal('CallTreesTest#test_call_infos', method.full_name)
25
+
26
+ call_trees = method.call_trees
27
+ assert_empty(call_trees.callers)
28
+ assert_equal(1, call_trees.callees.length)
29
+ assert_kind_of(RubyProf::AggregateCallTree, call_trees.callees[0])
30
+ assert_equal('CallTreesTest#some_method_1', call_trees.callees[0].target.full_name)
31
+
32
+ method = thread.methods[1]
33
+ assert_equal('CallTreesTest#some_method_1', method.full_name)
34
+
35
+ call_trees = method.call_trees
36
+ assert_equal(1, call_trees.callers.length)
37
+ assert_kind_of(RubyProf::AggregateCallTree, call_trees.callers[0])
38
+ assert_equal('CallTreesTest#test_call_infos', call_trees.callers[0].parent.target.full_name)
39
+ assert_equal(1, call_trees.callees.length)
40
+ assert_kind_of(RubyProf::AggregateCallTree, call_trees.callees[0])
41
+ assert_equal('CallTreesTest#some_method_2', call_trees.callees[0].target.full_name)
42
+
43
+ method = thread.methods[2]
44
+ assert_equal('CallTreesTest#some_method_2', method.full_name)
45
+
46
+ call_trees = method.call_trees
47
+ assert_equal(1, call_trees.callers.length)
48
+ assert_kind_of(RubyProf::AggregateCallTree, call_trees.callers[0])
49
+ assert_equal('CallTreesTest#some_method_1', call_trees.callers[0].parent.target.full_name)
50
+ assert_empty(call_trees.callees)
51
+ end
52
+
53
+ def test_gc
54
+ result = RubyProf.profile do
55
+ some_method_1
56
+ end
57
+
58
+ method = result.threads.first.methods[1]
59
+
60
+ 100.times do |i|
61
+ method.call_trees.callers
62
+ GC.start
63
+ end
64
+ assert(true)
65
+ end
66
+ end
@@ -43,13 +43,12 @@ class ExcludeMethodsTest < TestCase
43
43
  obj = ExcludeMethodsClass.new
44
44
  prf = RubyProf::Profile.new
45
45
 
46
- result = prf.profile { 5.times {obj.a} }
46
+ result = prf.profile {obj.a}
47
47
  methods = result.threads.first.methods.sort.reverse
48
-
49
48
  assert_equal(10, methods.count)
50
49
  assert_equal('ExcludeMethodsTest#test_methods_can_be_profiled', methods[0].full_name)
51
- assert_equal('Integer#times', methods[1].full_name)
52
- assert_equal('ExcludeMethodsClass#a', methods[2].full_name)
50
+ assert_equal('ExcludeMethodsClass#a', methods[1].full_name)
51
+ assert_equal('Integer#times', methods[2].full_name)
53
52
  assert_equal('ExcludeMethodsClass#b', methods[3].full_name)
54
53
  assert_equal('<Class::ExcludeMethodsClass>#e', methods[4].full_name)
55
54
  assert_equal('<Class::ExcludeMethodsClass>#f', methods[5].full_name)
@@ -65,7 +64,7 @@ class ExcludeMethodsTest < TestCase
65
64
 
66
65
  prf.exclude_methods!(Integer, :times)
67
66
 
68
- result = prf.profile { 5.times {obj.a} }
67
+ result = prf.profile {obj.a}
69
68
  methods = result.threads.first.methods.sort.reverse
70
69
 
71
70
  assert_equal(9, methods.count)
@@ -88,7 +87,7 @@ class ExcludeMethodsTest < TestCase
88
87
  prf.exclude_methods!(ExcludeMethodsClass.singleton_class, :f)
89
88
  prf.exclude_methods!(ExcludeMethodsModule.singleton_class, :d)
90
89
 
91
- result = prf.profile { 5.times {obj.a} }
90
+ result = prf.profile {obj.a}
92
91
  methods = result.threads.first.methods.sort.reverse
93
92
 
94
93
  assert_equal(7, methods.count)
@@ -107,13 +106,19 @@ class ExcludeMethodsTest < TestCase
107
106
 
108
107
  prf.exclude_common_methods!
109
108
 
110
- result = prf.profile { 5.times {obj.a} }
109
+ result = prf.profile {obj.a}
111
110
  methods = result.threads.first.methods.sort.reverse
112
111
 
113
112
  assert_equal(9, methods.count)
114
113
  assert_equal('ExcludeMethodsTest#test_exclude_common_methods1', methods[0].full_name)
115
114
  assert_equal('ExcludeMethodsClass#a', methods[1].full_name)
116
115
  assert_equal('ExcludeMethodsClass#b', methods[2].full_name)
116
+ assert_equal('<Class::ExcludeMethodsClass>#e', methods[3].full_name)
117
+ assert_equal('<Class::ExcludeMethodsClass>#f', methods[4].full_name)
118
+ assert_equal('Kernel#sleep', methods[5].full_name)
119
+ assert_equal('ExcludeMethodsModule#c', methods[6].full_name)
120
+ assert_equal('<Module::ExcludeMethodsModule>#d', methods[7].full_name)
121
+ assert_equal('Kernel#class', methods[8].full_name)
117
122
  end
118
123
 
119
124
  def test_exclude_common_methods2
@@ -130,14 +135,14 @@ class ExcludeMethodsTest < TestCase
130
135
 
131
136
  private
132
137
 
133
- def assert_method_has_been_eliminated(result, eliminated_method)
138
+ def assert_method_has_been_excluded(result, excluded_method)
134
139
  result.threads.each do |thread|
135
140
  thread.methods.each do |method|
136
- method.call_infos.each do |ci|
137
- assert(ci.target != eliminated_method, "broken self")
138
- assert(ci.parent.target != eliminated_method, "broken parent") if ci.parent
141
+ method.call_trees.each do |ci|
142
+ assert(ci.target != excluded_method, "broken self")
143
+ assert(ci.parent.target != excluded_method, "broken parent") if ci.parent
139
144
  ci.children.each do |callee|
140
- assert(callee.target != eliminated_method, "broken kid")
145
+ assert(callee.target != excluded_method, "broken kid")
141
146
  end
142
147
  end
143
148
  end