ruby-prof 1.1.0-x64-mingw32 → 1.3.0-x64-mingw32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES +19 -1
  3. data/bin/ruby-prof +100 -152
  4. data/ext/ruby_prof/rp_aggregate_call_tree.c +59 -0
  5. data/ext/ruby_prof/rp_aggregate_call_tree.h +13 -0
  6. data/ext/ruby_prof/rp_allocation.c +67 -59
  7. data/ext/ruby_prof/rp_allocation.h +3 -3
  8. data/ext/ruby_prof/rp_call_tree.c +369 -0
  9. data/ext/ruby_prof/rp_call_tree.h +43 -0
  10. data/ext/ruby_prof/rp_call_trees.c +288 -0
  11. data/ext/ruby_prof/rp_call_trees.h +28 -0
  12. data/ext/ruby_prof/rp_measure_allocations.c +11 -13
  13. data/ext/ruby_prof/rp_measure_process_time.c +11 -13
  14. data/ext/ruby_prof/rp_measure_wall_time.c +17 -15
  15. data/ext/ruby_prof/rp_measurement.c +47 -40
  16. data/ext/ruby_prof/rp_measurement.h +7 -7
  17. data/ext/ruby_prof/rp_method.c +116 -255
  18. data/ext/ruby_prof/rp_method.h +31 -39
  19. data/ext/ruby_prof/rp_profile.c +311 -281
  20. data/ext/ruby_prof/rp_profile.h +1 -2
  21. data/ext/ruby_prof/rp_stack.c +113 -105
  22. data/ext/ruby_prof/rp_stack.h +17 -20
  23. data/ext/ruby_prof/rp_thread.c +136 -111
  24. data/ext/ruby_prof/rp_thread.h +12 -9
  25. data/ext/ruby_prof/ruby_prof.c +27 -23
  26. data/ext/ruby_prof/ruby_prof.h +9 -0
  27. data/ext/ruby_prof/vc/ruby_prof.vcxproj +11 -7
  28. data/lib/ruby-prof.rb +2 -3
  29. data/lib/ruby-prof/assets/call_stack_printer.html.erb +4 -7
  30. data/lib/ruby-prof/assets/graph_printer.html.erb +5 -6
  31. data/lib/ruby-prof/{call_info.rb → call_tree.rb} +6 -6
  32. data/lib/ruby-prof/call_tree_visitor.rb +36 -0
  33. data/lib/ruby-prof/measurement.rb +5 -2
  34. data/lib/ruby-prof/method_info.rb +3 -15
  35. data/lib/ruby-prof/printers/call_info_printer.rb +12 -10
  36. data/lib/ruby-prof/printers/call_stack_printer.rb +19 -22
  37. data/lib/ruby-prof/printers/call_tree_printer.rb +1 -1
  38. data/lib/ruby-prof/printers/dot_printer.rb +3 -3
  39. data/lib/ruby-prof/printers/graph_printer.rb +3 -4
  40. data/lib/ruby-prof/printers/multi_printer.rb +2 -2
  41. data/lib/ruby-prof/rack.rb +3 -0
  42. data/lib/ruby-prof/thread.rb +3 -18
  43. data/lib/ruby-prof/version.rb +1 -1
  44. data/ruby-prof.gemspec +7 -0
  45. data/test/alias_test.rb +42 -45
  46. data/test/basic_test.rb +0 -86
  47. data/test/{call_info_visitor_test.rb → call_tree_visitor_test.rb} +6 -5
  48. data/test/call_trees_test.rb +66 -0
  49. data/test/exclude_methods_test.rb +17 -12
  50. data/test/fiber_test.rb +197 -9
  51. data/test/gc_test.rb +36 -42
  52. data/test/inverse_call_tree_test.rb +175 -0
  53. data/test/line_number_test.rb +67 -70
  54. data/test/marshal_test.rb +7 -11
  55. data/test/measure_allocations_test.rb +224 -234
  56. data/test/measure_allocations_trace_test.rb +224 -234
  57. data/test/measure_memory_trace_test.rb +814 -469
  58. data/test/measure_process_time_test.rb +0 -64
  59. data/test/measure_times.rb +2 -0
  60. data/test/measure_wall_time_test.rb +34 -58
  61. data/test/pause_resume_test.rb +19 -10
  62. data/test/prime.rb +1 -3
  63. data/test/prime_script.rb +6 -0
  64. data/test/printers_test.rb +1 -1
  65. data/test/recursive_test.rb +50 -54
  66. data/test/start_stop_test.rb +19 -19
  67. data/test/test_helper.rb +3 -15
  68. data/test/thread_test.rb +11 -11
  69. data/test/unique_call_path_test.rb +25 -95
  70. metadata +19 -10
  71. data/ext/ruby_prof/rp_call_info.c +0 -271
  72. data/ext/ruby_prof/rp_call_info.h +0 -35
  73. data/lib/2.6.5/ruby_prof.so +0 -0
  74. data/lib/ruby-prof/call_info_visitor.rb +0 -38
  75. data/test/parser_timings.rb +0 -24
@@ -137,7 +137,7 @@ module RubyProf
137
137
  output << "#{method.line} #{convert(method.self_time)}\n"
138
138
 
139
139
  # Now print out all the children methods
140
- method.callees.each do |callee|
140
+ method.call_trees.callees.each do |callee|
141
141
  output << "cfl=#{file(callee.target)}\n"
142
142
  output << "cfn=#{self.calltree_name(callee.target)}\n"
143
143
  output << "calls=#{callee.called} #{callee.line}\n"
@@ -114,12 +114,12 @@ module RubyProf
114
114
  end
115
115
 
116
116
  def print_edges(total_time, method)
117
- method.callers.sort_by(&:total_time).reverse.each do |call_info|
118
- target_percentage = (call_info.target.total_time / total_time) * 100.0
117
+ method.call_trees.callers.sort_by(&:total_time).reverse.each do |call_tree|
118
+ target_percentage = (call_tree.target.total_time / total_time) * 100.0
119
119
  next if target_percentage < min_percent
120
120
 
121
121
  # Get children method
122
- puts "#{dot_id(method)} -> #{dot_id(call_info.target)} [label=\"#{call_info.called}/#{call_info.target.called}\" fontsize=10 fontcolor=#{EDGE_COLOR}];"
122
+ puts "#{dot_id(method)} -> #{dot_id(call_tree.target)} [label=\"#{call_tree.called}/#{call_tree.target.called}\" fontsize=10 fontcolor=#{EDGE_COLOR}];"
123
123
  end
124
124
  end
125
125
 
@@ -78,8 +78,7 @@ module RubyProf
78
78
  end
79
79
 
80
80
  def print_parents(thread, method)
81
- return if method.root?
82
- method.callers.sort_by(&:total_time).each do |caller|
81
+ method.call_trees.callers.sort_by(&:total_time).each do |caller|
83
82
  @output << " " * 2 * PERCENTAGE_WIDTH
84
83
  @output << sprintf("%#{TIME_WIDTH}.3f", caller.total_time)
85
84
  @output << sprintf("%#{TIME_WIDTH}.3f", caller.self_time)
@@ -88,13 +87,13 @@ module RubyProf
88
87
 
89
88
  call_called = "#{caller.called}/#{method.called}"
90
89
  @output << sprintf("%#{CALL_WIDTH}s", call_called)
91
- @output << sprintf(" %s", caller.parent.full_name)
90
+ @output << sprintf(" %s", caller.parent.target.full_name)
92
91
  @output << "\n"
93
92
  end
94
93
  end
95
94
 
96
95
  def print_children(method)
97
- method.callees.sort_by(&:total_time).reverse.each do |child|
96
+ method.call_trees.callees.sort_by(&:total_time).reverse.each do |child|
98
97
  # Get children method
99
98
 
100
99
  @output << " " * 2 * PERCENTAGE_WIDTH
@@ -12,7 +12,7 @@ module RubyProf
12
12
  @graph_html_printer = GraphHtmlPrinter.new(result) if printers.include?(:graph_html)
13
13
 
14
14
  @tree_printer = CallTreePrinter.new(result) if printers.include?(:tree)
15
- @call_info_printer = CallInfoPrinter.new(result) if printers.include?(:call_info)
15
+ @call_info_printer = CallInfoPrinter.new(result) if printers.include?(:call_tree)
16
16
 
17
17
  @stack_printer = CallStackPrinter.new(result) if printers.include?(:stack)
18
18
  @dot_printer = DotPrinter.new(result) if printers.include?(:dot)
@@ -58,7 +58,7 @@ module RubyProf
58
58
 
59
59
  # the name of the callinfo profile file
60
60
  def call_info_report
61
- "#{@directory}/#{@profile}.call_info.txt"
61
+ "#{@directory}/#{@profile}.call_tree.txt"
62
62
  end
63
63
 
64
64
  # the name of the callgrind profile file
@@ -126,6 +126,9 @@ module Rack
126
126
  if @options[:request_thread_only]
127
127
  options[:include_threads] = [Thread.current]
128
128
  end
129
+ if @options[:merge_fibers]
130
+ options[:merge_fibers] = true
131
+ end
129
132
  options
130
133
  end
131
134
 
@@ -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.3.0"
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