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.
- checksums.yaml +4 -4
- data/CHANGES +48 -1
- data/Rakefile +2 -14
- data/bin/ruby-prof +100 -152
- data/ext/ruby_prof/extconf.rb +8 -28
- data/ext/ruby_prof/rp_aggregate_call_tree.c +59 -0
- data/ext/ruby_prof/rp_aggregate_call_tree.h +13 -0
- data/ext/ruby_prof/rp_allocation.c +67 -59
- data/ext/ruby_prof/rp_allocation.h +3 -3
- data/ext/ruby_prof/rp_call_tree.c +369 -0
- data/ext/ruby_prof/rp_call_tree.h +43 -0
- data/ext/ruby_prof/rp_call_trees.c +288 -0
- data/ext/ruby_prof/rp_call_trees.h +28 -0
- data/ext/ruby_prof/rp_measure_allocations.c +12 -14
- data/ext/ruby_prof/rp_measure_process_time.c +12 -14
- data/ext/ruby_prof/rp_measure_wall_time.c +17 -15
- data/ext/ruby_prof/rp_measurement.c +47 -40
- data/ext/ruby_prof/rp_measurement.h +7 -7
- data/ext/ruby_prof/rp_method.c +116 -255
- data/ext/ruby_prof/rp_method.h +31 -39
- data/ext/ruby_prof/rp_profile.c +316 -303
- data/ext/ruby_prof/rp_profile.h +1 -3
- data/ext/ruby_prof/rp_stack.c +122 -106
- data/ext/ruby_prof/rp_stack.h +17 -20
- data/ext/ruby_prof/rp_thread.c +136 -111
- data/ext/ruby_prof/rp_thread.h +12 -9
- data/ext/ruby_prof/ruby_prof.c +27 -23
- data/ext/ruby_prof/ruby_prof.h +9 -0
- data/ext/ruby_prof/vc/ruby_prof.sln +8 -0
- data/ext/ruby_prof/vc/ruby_prof.vcxproj +22 -7
- data/lib/2.7/ruby_prof.so +0 -0
- data/lib/ruby-prof.rb +5 -5
- data/lib/ruby-prof/assets/call_stack_printer.html.erb +4 -7
- data/lib/ruby-prof/assets/graph_printer.html.erb +5 -6
- data/lib/ruby-prof/{call_info.rb → call_tree.rb} +6 -6
- data/lib/ruby-prof/call_tree_visitor.rb +36 -0
- data/lib/ruby-prof/compatibility.rb +0 -10
- data/lib/ruby-prof/measurement.rb +5 -2
- data/lib/ruby-prof/method_info.rb +3 -15
- data/lib/ruby-prof/printers/abstract_printer.rb +12 -2
- data/lib/ruby-prof/printers/call_info_printer.rb +12 -10
- data/lib/ruby-prof/printers/call_stack_printer.rb +20 -22
- data/lib/ruby-prof/printers/call_tree_printer.rb +1 -1
- data/lib/ruby-prof/printers/dot_printer.rb +3 -3
- data/lib/ruby-prof/printers/flat_printer.rb +3 -2
- data/lib/ruby-prof/printers/graph_printer.rb +4 -5
- data/lib/ruby-prof/printers/multi_printer.rb +2 -2
- data/lib/ruby-prof/profile.rb +8 -4
- data/lib/ruby-prof/rack.rb +51 -127
- data/lib/ruby-prof/thread.rb +3 -18
- data/lib/ruby-prof/version.rb +1 -1
- data/ruby-prof.gemspec +7 -0
- data/test/alias_test.rb +42 -45
- data/test/basic_test.rb +0 -86
- data/test/{call_info_visitor_test.rb → call_tree_visitor_test.rb} +6 -5
- data/test/call_trees_test.rb +66 -0
- data/test/exclude_methods_test.rb +17 -12
- data/test/fiber_test.rb +95 -39
- data/test/gc_test.rb +36 -42
- data/test/inverse_call_tree_test.rb +175 -0
- data/test/line_number_test.rb +67 -70
- data/test/marshal_test.rb +7 -13
- data/test/measure_allocations_test.rb +224 -234
- data/test/measure_allocations_trace_test.rb +224 -234
- data/test/measure_memory_trace_test.rb +814 -469
- data/test/measure_process_time_test.rb +0 -64
- data/test/measure_times.rb +2 -0
- data/test/measure_wall_time_test.rb +34 -58
- data/test/pause_resume_test.rb +19 -10
- data/test/prime.rb +1 -3
- data/test/prime_script.rb +6 -0
- data/test/printer_call_stack_test.rb +0 -1
- data/test/printer_call_tree_test.rb +0 -1
- data/test/printer_flat_test.rb +61 -30
- data/test/printer_graph_html_test.rb +0 -1
- data/test/printer_graph_test.rb +3 -4
- data/test/printers_test.rb +2 -2
- data/test/printing_recursive_graph_test.rb +1 -1
- data/test/profile_test.rb +16 -0
- data/test/rack_test.rb +0 -64
- data/test/recursive_test.rb +50 -54
- data/test/start_stop_test.rb +19 -19
- data/test/test_helper.rb +6 -17
- data/test/thread_test.rb +11 -11
- data/test/unique_call_path_test.rb +25 -95
- metadata +22 -11
- data/ext/ruby_prof/rp_call_info.c +0 -271
- data/ext/ruby_prof/rp_call_info.h +0 -35
- data/lib/2.6.5/ruby_prof.so +0 -0
- data/lib/ruby-prof/call_info_visitor.rb +0 -38
- data/test/parser_timings.rb +0 -24
data/test/printer_flat_test.rb
CHANGED
@@ -2,67 +2,98 @@
|
|
2
2
|
# encoding: UTF-8
|
3
3
|
|
4
4
|
require File.expand_path('../test_helper', __FILE__)
|
5
|
-
require 'stringio'
|
6
5
|
require 'fileutils'
|
6
|
+
require 'stringio'
|
7
7
|
require 'tmpdir'
|
8
8
|
require_relative 'prime'
|
9
9
|
|
10
10
|
# -- Tests ----
|
11
11
|
class PrinterFlatTest < TestCase
|
12
|
-
def
|
13
|
-
|
14
|
-
RubyProf::measure_mode = RubyProf::WALL_TIME
|
15
|
-
@result = RubyProf.profile do
|
12
|
+
def run_profile
|
13
|
+
RubyProf.profile(:measure_mode => RubyProf::WALL_TIME) do
|
16
14
|
run_primes(1000, 5000)
|
17
15
|
end
|
18
16
|
end
|
19
17
|
|
20
18
|
def flat_output_nth_column_values(output, n)
|
21
|
-
only_method_calls = output.split("\n").select { |line| line =~
|
22
|
-
only_method_calls.collect { |line| line.split(
|
19
|
+
only_method_calls = output.split("\n").select { |line| line =~ /^\s+\d+/ }
|
20
|
+
only_method_calls.collect { |line| line.split(/\s+/)[n] }
|
23
21
|
end
|
24
22
|
|
25
|
-
def
|
26
|
-
|
27
|
-
|
23
|
+
def helper_test_flat_string(klass)
|
24
|
+
output = StringIO.new
|
25
|
+
|
26
|
+
printer = klass.new(self.run_profile)
|
27
|
+
printer.print(output)
|
28
|
+
|
29
|
+
assert_match(/Thread ID: -?\d+/i, output.string)
|
30
|
+
assert_match(/Fiber ID: -?\d+/i, output.string)
|
31
|
+
assert_match(/Total: \d+\.\d+/i, output.string)
|
32
|
+
assert_match(/Object#run_primes/i, output.string)
|
33
|
+
output.string
|
28
34
|
end
|
29
35
|
|
36
|
+
def assert_sorted(array)
|
37
|
+
array = array.map(&:to_f) # allow for > 10s times to sort right, since lexographically 4.0 > 10.0
|
38
|
+
assert_equal(array, array.sort.reverse)
|
39
|
+
end
|
40
|
+
|
30
41
|
def test_flat_string
|
31
42
|
output = helper_test_flat_string(RubyProf::FlatPrinter)
|
32
43
|
assert_match(/prime.rb/, output)
|
33
44
|
end
|
34
45
|
|
35
|
-
def helper_test_flat_string(klass)
|
36
|
-
output = ''
|
37
|
-
|
38
|
-
printer = klass.new(@result)
|
39
|
-
printer.print(output)
|
40
|
-
|
41
|
-
assert_match(/Thread ID: -?\d+/i, output)
|
42
|
-
assert_match(/Fiber ID: -?\d+/i, output)
|
43
|
-
assert_match(/Total: \d+\.\d+/i, output)
|
44
|
-
assert_match(/Object#run_primes/i, output)
|
45
|
-
output
|
46
|
-
end
|
47
|
-
|
48
46
|
def test_flat_result_sorting_by_self_time_is_default
|
49
|
-
printer = RubyProf::FlatPrinter.new(
|
47
|
+
printer = RubyProf::FlatPrinter.new(self.run_profile)
|
50
48
|
|
51
|
-
|
52
|
-
|
49
|
+
output = StringIO.new
|
50
|
+
printer.print(output)
|
51
|
+
self_times = flat_output_nth_column_values(output.string, 3)
|
53
52
|
|
54
53
|
assert_sorted self_times
|
55
54
|
end
|
56
55
|
|
57
56
|
def test_flat_result_sorting
|
58
|
-
printer = RubyProf::FlatPrinter.new(
|
57
|
+
printer = RubyProf::FlatPrinter.new(self.run_profile)
|
59
58
|
|
60
59
|
sort_method_with_column_number = {:total_time => 2, :self_time => 3, :wait_time => 4, :children_time => 5}
|
61
60
|
|
62
61
|
sort_method_with_column_number.each_pair do |sort_method, n|
|
63
|
-
|
64
|
-
|
65
|
-
|
62
|
+
output = StringIO.new
|
63
|
+
printer.print(output, :sort_method => sort_method)
|
64
|
+
|
65
|
+
times = flat_output_nth_column_values(output.string, n)
|
66
|
+
assert_sorted(times)
|
66
67
|
end
|
67
68
|
end
|
69
|
+
|
70
|
+
def test_flat_result_max_percent
|
71
|
+
printer = RubyProf::FlatPrinter.new(self.run_profile)
|
72
|
+
|
73
|
+
output = StringIO.new
|
74
|
+
printer.print(output, max_percent: 1)
|
75
|
+
self_percents = flat_output_nth_column_values(output.string, 1).map(&:to_f)
|
76
|
+
|
77
|
+
assert self_percents.max < 1
|
78
|
+
end
|
79
|
+
|
80
|
+
def test_flat_result_filter_by_total_time
|
81
|
+
printer = RubyProf::FlatPrinter.new(self.run_profile)
|
82
|
+
|
83
|
+
output = StringIO.new
|
84
|
+
printer.print(output, filter_by: :total_time, min_percent: 50)
|
85
|
+
total_times = flat_output_nth_column_values(output.string, 2).map(&:to_f)
|
86
|
+
|
87
|
+
assert (total_times.min / total_times.max) >= 0.5
|
88
|
+
end
|
89
|
+
|
90
|
+
def test_flat_result_filter_by_self_time
|
91
|
+
printer = RubyProf::FlatPrinter.new(self.run_profile)
|
92
|
+
|
93
|
+
output = StringIO.new
|
94
|
+
printer.print(output, filter_by: :self_time, min_percent: 0.1)
|
95
|
+
self_percents = flat_output_nth_column_values(output.string, 1).map(&:to_f)
|
96
|
+
|
97
|
+
assert self_percents.min >= 0.1
|
98
|
+
end
|
68
99
|
end
|
data/test/printer_graph_test.rb
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
# encoding: UTF-8
|
3
3
|
|
4
4
|
require File.expand_path('../test_helper', __FILE__)
|
5
|
-
require 'stringio'
|
6
5
|
require 'fileutils'
|
7
6
|
require 'tmpdir'
|
8
7
|
require_relative 'prime'
|
@@ -22,9 +21,9 @@ class PrinterGraphTest < TestCase
|
|
22
21
|
only_root_calls.collect { |line| line.split(/ +/)[n] }
|
23
22
|
end
|
24
23
|
|
25
|
-
def assert_sorted
|
26
|
-
array = array.map{|n| n.to_f} # allow for > 10s times to sort right, since lexographically 4.0 > 10.0
|
27
|
-
assert_equal
|
24
|
+
def assert_sorted(array)
|
25
|
+
array = array.map {|n| n.to_f} # allow for > 10s times to sort right, since lexographically 4.0 > 10.0
|
26
|
+
assert_equal(array, array.sort.reverse, "Array #{array.inspect} is not sorted")
|
28
27
|
end
|
29
28
|
|
30
29
|
def test_graph_results_sorting
|
data/test/printers_test.rb
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
# encoding: UTF-8
|
3
3
|
|
4
4
|
require File.expand_path('../test_helper', __FILE__)
|
5
|
-
require 'stringio'
|
6
5
|
require 'fileutils'
|
6
|
+
require 'stringio'
|
7
7
|
require 'tmpdir'
|
8
8
|
require_relative 'prime'
|
9
9
|
|
@@ -20,7 +20,7 @@ class PrintersTest < TestCase
|
|
20
20
|
def test_printers
|
21
21
|
output = ENV['SHOW_RUBY_PROF_PRINTER_OUTPUT'] == "1" ? STDOUT : StringIO.new('')
|
22
22
|
|
23
|
-
printer = RubyProf::
|
23
|
+
printer = RubyProf::CallStackPrinter.new(@result)
|
24
24
|
printer.print(output)
|
25
25
|
|
26
26
|
printer = RubyProf::CallTreePrinter.new(@result)
|
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: UTF-8
|
3
|
+
|
4
|
+
require File.expand_path('../test_helper', __FILE__)
|
5
|
+
|
6
|
+
class ProfileTest < TestCase
|
7
|
+
def test_measure_mode
|
8
|
+
profile = RubyProf::Profile.new(:measure_mode => RubyProf::PROCESS_TIME)
|
9
|
+
assert_equal(RubyProf::PROCESS_TIME, profile.measure_mode)
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_measure_mode_string
|
13
|
+
profile = RubyProf::Profile.new(:measure_mode => RubyProf::PROCESS_TIME)
|
14
|
+
assert_equal("process_time", profile.measure_mode_string)
|
15
|
+
end
|
16
|
+
end
|
data/test/rack_test.rb
CHANGED
@@ -24,16 +24,6 @@ module Rack
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
-
module Rack
|
28
|
-
class RubyProf
|
29
|
-
attr_reader :_profiler
|
30
|
-
|
31
|
-
def public_delete_profiler!
|
32
|
-
delete_profiler!
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
27
|
class RackTest < TestCase
|
38
28
|
def test_create_print_path
|
39
29
|
path = Dir.mktmpdir
|
@@ -100,58 +90,4 @@ class RackTest < TestCase
|
|
100
90
|
file_path = ::File.join(path, 'path-to-resource.json-dynamic.txt')
|
101
91
|
assert(File.exist?(file_path))
|
102
92
|
end
|
103
|
-
|
104
|
-
def test_works_for_multiple_requests
|
105
|
-
path = Dir.mktmpdir
|
106
|
-
|
107
|
-
adapter = Rack::RubyProf.new(FakeRackApp.new, :path => path, :max_requests => 2)
|
108
|
-
|
109
|
-
# make a 1st request, and check that this didn't create any files
|
110
|
-
adapter.call(:fake_env)
|
111
|
-
assert(Dir["#{path}/*"].empty?)
|
112
|
-
|
113
|
-
# now a second request should create all the expected files
|
114
|
-
adapter.call(:fake_env)
|
115
|
-
%w(flat.txt graph.txt graph.html call_stack.html).each do |base_name|
|
116
|
-
file_path = ::File.join(path, "multi-requests-2-#{base_name}")
|
117
|
-
assert(File.exist?(file_path))
|
118
|
-
end
|
119
|
-
|
120
|
-
# let's clean up
|
121
|
-
FileUtils.rm_rf(Dir["#{path}/*"])
|
122
|
-
|
123
|
-
# and do the same again for the next 2 requests
|
124
|
-
adapter.call(:fake_env)
|
125
|
-
assert(Dir["#{path}/*"].empty?)
|
126
|
-
|
127
|
-
adapter.call(:fake_env)
|
128
|
-
%w(flat.txt graph.txt graph.html call_stack.html).each do |base_name|
|
129
|
-
file_path = ::File.join(path, "multi-requests-2-#{base_name}")
|
130
|
-
assert(File.exist?(file_path))
|
131
|
-
end
|
132
|
-
end
|
133
|
-
|
134
|
-
def test_tries_to_print_results_if_shut_down_before_max_requests_reached
|
135
|
-
path = Dir.mktmpdir
|
136
|
-
|
137
|
-
adapter = Rack::RubyProf.new(FakeRackApp.new, :path => path, :max_requests => 100)
|
138
|
-
|
139
|
-
# make a 1st request, and check that this didn't create any files
|
140
|
-
adapter.call(:fake_env)
|
141
|
-
assert(Dir["#{path}/*"].empty?)
|
142
|
-
|
143
|
-
adapter.public_delete_profiler!
|
144
|
-
|
145
|
-
%w(flat.txt graph.txt graph.html call_stack.html).each do |base_name|
|
146
|
-
file_path = ::File.join(path, "multi-requests-1-#{base_name}")
|
147
|
-
assert(File.exist?(file_path))
|
148
|
-
end
|
149
|
-
end
|
150
|
-
|
151
|
-
def test_it_uses_separate_profilers_if_not_aggregating_multiple_requests
|
152
|
-
adapter1 = Rack::RubyProf.new(FakeRackApp.new)
|
153
|
-
adapter2 = Rack::RubyProf.new(FakeRackApp.new)
|
154
|
-
|
155
|
-
assert(adapter1.object_id != adapter2.object_id)
|
156
|
-
end
|
157
93
|
end
|
data/test/recursive_test.rb
CHANGED
@@ -58,13 +58,11 @@ class RecursiveTest < TestCase
|
|
58
58
|
assert_in_delta(0, method.wait_time, 0.01)
|
59
59
|
assert_in_delta(2, method.children_time, 0.1)
|
60
60
|
|
61
|
-
assert_equal(
|
62
|
-
call_info = method.callers[0]
|
63
|
-
assert_nil(call_info.parent)
|
61
|
+
assert_equal(0, method.call_trees.callers.length)
|
64
62
|
|
65
|
-
assert_equal(1, method.callees.length)
|
66
|
-
|
67
|
-
assert_equal('SimpleRecursion#simple',
|
63
|
+
assert_equal(1, method.call_trees.callees.length)
|
64
|
+
call_tree = method.call_trees.callees[0]
|
65
|
+
assert_equal('SimpleRecursion#simple', call_tree.target.full_name)
|
68
66
|
|
69
67
|
# Method 1: SimpleRecursion#simple
|
70
68
|
method = methods[1]
|
@@ -76,19 +74,19 @@ class RecursiveTest < TestCase
|
|
76
74
|
assert_in_delta(0, method.wait_time, 0.1)
|
77
75
|
assert_in_delta(2, method.children_time, 0.1)
|
78
76
|
|
79
|
-
assert_equal(2, method.callers.length)
|
80
|
-
|
81
|
-
assert_equal('RecursiveTest#test_simple',
|
77
|
+
assert_equal(2, method.call_trees.callers.length)
|
78
|
+
call_tree = method.call_trees.callers[0]
|
79
|
+
assert_equal('RecursiveTest#test_simple', call_tree.parent.target.full_name)
|
82
80
|
|
83
|
-
|
84
|
-
assert_equal('SimpleRecursion#simple',
|
81
|
+
call_tree = method.call_trees.callers[1]
|
82
|
+
assert_equal('SimpleRecursion#simple', call_tree.parent.target.full_name)
|
85
83
|
|
86
|
-
assert_equal(2, method.callees.length)
|
87
|
-
|
88
|
-
assert_equal('Kernel#sleep',
|
84
|
+
assert_equal(2, method.call_trees.callees.length)
|
85
|
+
call_tree = method.call_trees.callees[0]
|
86
|
+
assert_equal('Kernel#sleep', call_tree.target.full_name)
|
89
87
|
|
90
|
-
|
91
|
-
assert_equal('SimpleRecursion#simple',
|
88
|
+
call_tree = method.call_trees.callees[1]
|
89
|
+
assert_equal('SimpleRecursion#simple', call_tree.target.full_name)
|
92
90
|
|
93
91
|
# Method 2: Kernel#sleep
|
94
92
|
method = methods[2]
|
@@ -100,12 +98,12 @@ class RecursiveTest < TestCase
|
|
100
98
|
assert_in_delta(0, method.wait_time, 0.1)
|
101
99
|
assert_in_delta(0, method.children_time, 0.1)
|
102
100
|
|
103
|
-
assert_equal(1, method.callers.length)
|
104
|
-
|
105
|
-
assert_equal('SimpleRecursion#simple',
|
106
|
-
assert_equal(0, method.callees.length)
|
101
|
+
assert_equal(1, method.call_trees.callers.length)
|
102
|
+
call_tree = method.call_trees.callers[0]
|
103
|
+
assert_equal('SimpleRecursion#simple', call_tree.parent.target.full_name)
|
104
|
+
assert_equal(0, method.call_trees.callees.length)
|
107
105
|
|
108
|
-
assert_equal(0, method.callees.length)
|
106
|
+
assert_equal(0, method.call_trees.callees.length)
|
109
107
|
end
|
110
108
|
|
111
109
|
def test_cycle
|
@@ -125,13 +123,11 @@ class RecursiveTest < TestCase
|
|
125
123
|
assert_in_delta(0, method.wait_time, 0.01)
|
126
124
|
assert_in_delta(5, method.children_time, 0.1)
|
127
125
|
|
128
|
-
assert_equal(
|
129
|
-
call_info = method.callers[0]
|
130
|
-
assert_nil(call_info.parent)
|
126
|
+
assert_equal(0, method.call_trees.callers.length)
|
131
127
|
|
132
|
-
assert_equal(1, method.callees.length)
|
133
|
-
|
134
|
-
assert_equal('SimpleRecursion#render',
|
128
|
+
assert_equal(1, method.call_trees.callees.length)
|
129
|
+
call_tree = method.call_trees.callees[0]
|
130
|
+
assert_equal('SimpleRecursion#render', call_tree.target.full_name)
|
135
131
|
|
136
132
|
method = methods[1]
|
137
133
|
assert_equal('SimpleRecursion#render', method.full_name)
|
@@ -142,13 +138,13 @@ class RecursiveTest < TestCase
|
|
142
138
|
assert_in_delta(0, method.wait_time, 0.01)
|
143
139
|
assert_in_delta(5, method.children_time, 0.1)
|
144
140
|
|
145
|
-
assert_equal(1, method.callers.length)
|
146
|
-
|
147
|
-
assert_equal('RecursiveTest#test_cycle',
|
141
|
+
assert_equal(1, method.call_trees.callers.length)
|
142
|
+
call_tree = method.call_trees.callers[0]
|
143
|
+
assert_equal('RecursiveTest#test_cycle', call_tree.parent.target.full_name)
|
148
144
|
|
149
|
-
assert_equal(1, method.callees.length)
|
150
|
-
|
151
|
-
assert_equal('Integer#times',
|
145
|
+
assert_equal(1, method.call_trees.callees.length)
|
146
|
+
call_tree = method.call_trees.callees[0]
|
147
|
+
assert_equal('Integer#times', call_tree.target.full_name)
|
152
148
|
|
153
149
|
method = methods[2]
|
154
150
|
assert_equal('Integer#times', method.full_name)
|
@@ -159,16 +155,16 @@ class RecursiveTest < TestCase
|
|
159
155
|
assert_in_delta(0, method.wait_time, 0.1)
|
160
156
|
assert_in_delta(5, method.children_time, 0.1)
|
161
157
|
|
162
|
-
assert_equal(2, method.callers.length)
|
163
|
-
|
164
|
-
assert_equal('SimpleRecursion#render',
|
158
|
+
assert_equal(2, method.call_trees.callers.length)
|
159
|
+
call_tree = method.call_trees.callers[0]
|
160
|
+
assert_equal('SimpleRecursion#render', call_tree.parent.target.full_name)
|
165
161
|
|
166
|
-
|
167
|
-
assert_equal('SimpleRecursion#render_partial',
|
162
|
+
call_tree = method.call_trees.callers[1]
|
163
|
+
assert_equal('SimpleRecursion#render_partial', call_tree.parent.target.full_name)
|
168
164
|
|
169
|
-
assert_equal(1, method.callees.length)
|
170
|
-
|
171
|
-
assert_equal('SimpleRecursion#render_partial',
|
165
|
+
assert_equal(1, method.call_trees.callees.length)
|
166
|
+
call_tree = method.call_trees.callees[0]
|
167
|
+
assert_equal('SimpleRecursion#render_partial', call_tree.target.full_name)
|
172
168
|
|
173
169
|
method = methods[3]
|
174
170
|
assert_equal('SimpleRecursion#render_partial', method.full_name)
|
@@ -179,22 +175,22 @@ class RecursiveTest < TestCase
|
|
179
175
|
assert_in_delta(0, method.wait_time, 0.01)
|
180
176
|
assert_in_delta(5, method.children_time, 0.05)
|
181
177
|
|
182
|
-
assert_equal(2, method.callers.length)
|
183
|
-
|
184
|
-
assert_equal('Integer#times',
|
178
|
+
assert_equal(2, method.call_trees.callers.length)
|
179
|
+
call_tree = method.call_trees.callers[0]
|
180
|
+
assert_equal('Integer#times', call_tree.parent.target.full_name)
|
185
181
|
|
186
|
-
|
187
|
-
assert_equal('SimpleRecursion#render_partial',
|
182
|
+
call_tree = method.call_trees.callers[1]
|
183
|
+
assert_equal('SimpleRecursion#render_partial', call_tree.parent.target.full_name)
|
188
184
|
|
189
|
-
assert_equal(3, method.callees.length)
|
190
|
-
|
191
|
-
assert_equal('Kernel#sleep',
|
185
|
+
assert_equal(3, method.call_trees.callees.length)
|
186
|
+
call_tree = method.call_trees.callees[0]
|
187
|
+
assert_equal('Kernel#sleep', call_tree.target.full_name)
|
192
188
|
|
193
|
-
|
194
|
-
assert_equal('SimpleRecursion#render_partial',
|
189
|
+
call_tree = method.call_trees.callees[1]
|
190
|
+
assert_equal('SimpleRecursion#render_partial', call_tree.target.full_name)
|
195
191
|
|
196
|
-
|
197
|
-
assert_equal('Integer#times',
|
192
|
+
call_tree = method.call_trees.callees[2]
|
193
|
+
assert_equal('Integer#times', call_tree.target.full_name)
|
198
194
|
|
199
195
|
method = methods[4]
|
200
196
|
assert_equal('Kernel#sleep', method.full_name)
|
@@ -205,6 +201,6 @@ class RecursiveTest < TestCase
|
|
205
201
|
assert_in_delta(0, method.wait_time, 0.01)
|
206
202
|
assert_in_delta(0, method.children_time, 0.01)
|
207
203
|
|
208
|
-
assert_equal(0, method.callees.length)
|
204
|
+
assert_equal(0, method.call_trees.callees.length)
|
209
205
|
end
|
210
206
|
end
|