ruby-prof 0.8.1-x86-mingw32 → 0.11.0.rc1-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +89 -13
- data/LICENSE +4 -3
- data/{README → README.rdoc} +155 -162
- data/Rakefile +50 -123
- data/bin/ruby-prof +86 -47
- data/examples/empty.png +0 -0
- data/examples/graph.dot +106 -0
- data/examples/graph.png +0 -0
- data/examples/minus.png +0 -0
- data/examples/multi.flat.txt +23 -0
- data/examples/multi.graph.html +906 -0
- data/examples/multi.grind.dat +194 -0
- data/examples/multi.stack.html +573 -0
- data/examples/plus.png +0 -0
- data/examples/stack.html +573 -0
- data/ext/ruby_prof/extconf.rb +53 -0
- data/ext/ruby_prof/rp_call_info.c +369 -0
- data/ext/ruby_prof/rp_call_info.h +46 -0
- data/ext/ruby_prof/rp_measure.c +48 -0
- data/ext/ruby_prof/rp_measure.h +45 -0
- data/ext/ruby_prof/rp_measure_allocations.c +86 -0
- data/ext/ruby_prof/rp_measure_cpu_time.c +112 -0
- data/ext/ruby_prof/rp_measure_gc_runs.c +87 -0
- data/ext/ruby_prof/rp_measure_gc_time.c +73 -0
- data/ext/ruby_prof/rp_measure_memory.c +81 -0
- data/ext/ruby_prof/rp_measure_process_time.c +71 -0
- data/ext/ruby_prof/rp_measure_wall_time.c +42 -0
- data/ext/ruby_prof/rp_method.c +363 -0
- data/ext/ruby_prof/rp_method.h +55 -0
- data/ext/ruby_prof/rp_stack.c +61 -0
- data/ext/ruby_prof/rp_stack.h +40 -0
- data/ext/ruby_prof/rp_thread.c +113 -0
- data/ext/ruby_prof/rp_thread.h +20 -0
- data/ext/ruby_prof/ruby_prof.c +332 -1377
- data/ext/ruby_prof/ruby_prof.h +54 -188
- data/ext/ruby_prof/version.h +6 -3
- data/lib/1.8/ruby_prof.so +0 -0
- data/lib/1.9/ruby_prof.exp +0 -0
- data/lib/1.9/ruby_prof.ilk +0 -0
- data/lib/1.9/ruby_prof.lib +0 -0
- data/lib/1.9/ruby_prof.pdb +0 -0
- data/lib/1.9/ruby_prof.so +0 -0
- data/lib/ruby-prof.rb +32 -18
- data/lib/ruby-prof/abstract_printer.rb +15 -5
- data/lib/ruby-prof/aggregate_call_info.rb +11 -3
- data/lib/ruby-prof/call_info.rb +68 -1
- data/lib/ruby-prof/call_stack_printer.rb +775 -0
- data/lib/ruby-prof/call_tree_printer.rb +17 -9
- data/lib/ruby-prof/compatibility.rb +134 -0
- data/lib/ruby-prof/dot_printer.rb +152 -0
- data/lib/ruby-prof/empty.png +0 -0
- data/lib/ruby-prof/flat_printer.rb +23 -24
- data/lib/ruby-prof/flat_printer_with_line_numbers.rb +17 -21
- data/lib/ruby-prof/graph_html_printer.rb +69 -39
- data/lib/ruby-prof/graph_printer.rb +35 -35
- data/lib/ruby-prof/method_info.rb +26 -4
- data/lib/ruby-prof/minus.png +0 -0
- data/lib/ruby-prof/multi_printer.rb +56 -0
- data/lib/ruby-prof/plus.png +0 -0
- data/lib/ruby-prof/profile.rb +72 -0
- data/lib/ruby-prof/rack.rb +31 -0
- data/lib/ruby-prof/symbol_to_proc.rb +3 -1
- data/lib/ruby-prof/task.rb +20 -19
- data/lib/ruby-prof/test.rb +5 -3
- data/lib/ruby_prof.exp +0 -0
- data/lib/ruby_prof.ilk +0 -0
- data/lib/ruby_prof.lib +0 -0
- data/lib/ruby_prof.pdb +0 -0
- data/lib/ruby_prof.so +0 -0
- data/lib/unprof.rb +2 -0
- data/test/aggregate_test.rb +29 -14
- data/test/basic_test.rb +3 -251
- data/test/bug_test.rb +6 -0
- data/test/duplicate_names_test.rb +4 -4
- data/test/dynamic_method_test.rb +61 -0
- data/test/enumerable_test.rb +4 -4
- data/test/exceptions_test.rb +6 -5
- data/test/exclude_threads_test.rb +47 -47
- data/test/exec_test.rb +5 -5
- data/test/line_number_test.rb +16 -16
- data/test/measure_allocations_test.rb +25 -0
- data/test/measure_cpu_time_test.rb +212 -0
- data/test/measure_gc_runs_test.rb +29 -0
- data/test/measure_gc_time_test.rb +29 -0
- data/test/measure_memory_test.rb +36 -0
- data/test/measure_process_time_test.rb +205 -0
- data/test/measure_wall_time_test.rb +209 -0
- data/test/method_elimination_test.rb +74 -0
- data/test/module_test.rb +12 -21
- data/test/multi_printer_test.rb +81 -0
- data/test/no_method_class_test.rb +5 -3
- data/test/prime.rb +7 -10
- data/test/prime_test.rb +3 -3
- data/test/printers_test.rb +180 -54
- data/test/recursive_test.rb +34 -72
- data/test/singleton_test.rb +5 -4
- data/test/stack_printer_test.rb +73 -0
- data/test/stack_test.rb +7 -7
- data/test/start_stop_test.rb +23 -6
- data/test/test_helper.rb +81 -0
- data/test/test_suite.rb +35 -21
- data/test/thread_test.rb +40 -39
- data/test/unique_call_path_test.rb +6 -6
- metadata +106 -51
- data/ext/ruby_prof/measure_allocations.h +0 -58
- data/ext/ruby_prof/measure_cpu_time.h +0 -152
- data/ext/ruby_prof/measure_gc_runs.h +0 -76
- data/ext/ruby_prof/measure_gc_time.h +0 -57
- data/ext/ruby_prof/measure_memory.h +0 -101
- data/ext/ruby_prof/measure_process_time.h +0 -52
- data/ext/ruby_prof/measure_wall_time.h +0 -53
- data/ext/ruby_prof/mingw/Rakefile +0 -23
- data/ext/ruby_prof/mingw/build.rake +0 -38
- data/rails/environment/profile.rb +0 -24
- data/rails/example/example_test.rb +0 -9
- data/rails/profile_test_helper.rb +0 -21
- data/test/current_failures_windows +0 -8
- data/test/measurement_test.rb +0 -121
- data/test/ruby-prof-bin +0 -20
data/test/prime_test.rb
CHANGED
data/test/printers_test.rb
CHANGED
@@ -1,40 +1,68 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
|
4
|
-
require File.
|
2
|
+
# encoding: UTF-8
|
3
|
+
|
4
|
+
require File.expand_path('../test_helper', __FILE__)
|
5
|
+
require 'stringio'
|
6
|
+
require 'fileutils'
|
5
7
|
|
6
8
|
# -- Tests ----
|
7
9
|
class PrintersTest < Test::Unit::TestCase
|
8
|
-
|
10
|
+
|
9
11
|
def go
|
10
|
-
run_primes
|
12
|
+
run_primes(1000)
|
11
13
|
end
|
12
|
-
|
14
|
+
|
13
15
|
def setup
|
14
|
-
RubyProf::measure_mode = RubyProf::WALL_TIME # WALL_TIME so we can use sleep in our test
|
16
|
+
RubyProf::measure_mode = RubyProf::WALL_TIME # WALL_TIME so we can use sleep in our test and get same measurements on linux and doze
|
15
17
|
@result = RubyProf.profile do
|
16
|
-
|
17
|
-
|
18
|
+
begin
|
19
|
+
run_primes(1000)
|
20
|
+
go
|
21
|
+
rescue => e
|
22
|
+
p e
|
23
|
+
end
|
18
24
|
end
|
19
|
-
|
25
|
+
|
20
26
|
end
|
21
|
-
|
27
|
+
|
22
28
|
def test_printers
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
29
|
+
assert_nothing_raised do
|
30
|
+
output = ENV['SHOW_RUBY_PROF_PRINTER_OUTPUT'] == "1" ? STDOUT : StringIO.new('')
|
31
|
+
|
32
|
+
printer = RubyProf::FlatPrinter.new(@result)
|
33
|
+
printer.print(output)
|
34
|
+
|
35
|
+
printer = RubyProf::FlatPrinterWithLineNumbers.new(@result)
|
36
|
+
printer.print(output)
|
37
|
+
|
38
|
+
printer = RubyProf::GraphHtmlPrinter.new(@result)
|
39
|
+
printer.print(output)
|
40
|
+
|
41
|
+
printer = RubyProf::GraphPrinter.new(@result)
|
42
|
+
printer.print(output)
|
43
|
+
|
44
|
+
printer = RubyProf::CallTreePrinter.new(@result)
|
45
|
+
printer.print(output)
|
46
|
+
output_dir = 'examples2'
|
47
|
+
|
48
|
+
if ENV['SAVE_NEW_PRINTER_EXAMPLES']
|
49
|
+
output_dir = 'examples'
|
50
|
+
end
|
51
|
+
FileUtils.mkdir_p output_dir
|
52
|
+
|
53
|
+
printer = RubyProf::DotPrinter.new(@result)
|
54
|
+
File.open("#{output_dir}/graph.dot", "w") {|f| printer.print(f)}
|
55
|
+
|
56
|
+
printer = RubyProf::CallStackPrinter.new(@result)
|
57
|
+
File.open("#{output_dir}/stack.html", "w") {|f| printer.print(f, :application => "primes")}
|
58
|
+
|
59
|
+
printer = RubyProf::MultiPrinter.new(@result)
|
60
|
+
printer.print(:path => "#{output_dir}", :profile => "multi", :application => "primes")
|
61
|
+
for file in ['empty.png', 'graph.dot', 'minus.png', 'multi.flat.txt', 'multi.graph.html', 'multi.grind.dat', 'multi.stack.html', 'plus.png', 'stack.html']
|
62
|
+
existant_file = output_dir + '/' + file
|
63
|
+
assert File.size(existant_file) > 0
|
64
|
+
end
|
65
|
+
end
|
38
66
|
end
|
39
67
|
|
40
68
|
def test_flat_string
|
@@ -44,32 +72,32 @@ class PrintersTest < Test::Unit::TestCase
|
|
44
72
|
|
45
73
|
def helper_test_flat_string klass
|
46
74
|
output = ''
|
47
|
-
|
75
|
+
|
48
76
|
printer = klass.new(@result)
|
49
77
|
printer.print(output)
|
50
|
-
|
78
|
+
|
51
79
|
assert_match(/Thread ID: -?\d+/i, output)
|
52
80
|
assert_match(/Total: \d+\.\d+/i, output)
|
53
81
|
assert_match(/Object#run_primes/i, output)
|
54
82
|
output
|
55
83
|
end
|
56
|
-
|
84
|
+
|
57
85
|
def test_flat_string_with_numbers
|
58
86
|
output = helper_test_flat_string RubyProf::FlatPrinterWithLineNumbers
|
59
|
-
assert_match(/prime.rb/, output)
|
87
|
+
assert_match(/prime.rb/, output)
|
60
88
|
assert_no_match(/ruby_runtime:0/, output)
|
61
89
|
assert_match(/called from/, output)
|
62
|
-
|
90
|
+
|
63
91
|
# should combine common parents
|
64
92
|
if RUBY_VERSION < '1.9'
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
93
|
+
assert_equal(3, output.scan(/Object#is_prime/).length)
|
94
|
+
else
|
95
|
+
# 1.9 inlines it's Fixnum#- so we don't see as many
|
96
|
+
assert_equal(2, output.scan(/Object#is_prime/).length)
|
69
97
|
end
|
70
|
-
|
98
|
+
assert_no_match(/\.\/test\/prime.rb/, output) # don't use relative paths
|
71
99
|
end
|
72
|
-
|
100
|
+
|
73
101
|
def test_graph_html_string
|
74
102
|
output = ''
|
75
103
|
printer = RubyProf::GraphHtmlPrinter.new(@result)
|
@@ -79,7 +107,7 @@ class PrintersTest < Test::Unit::TestCase
|
|
79
107
|
assert_match( %r{<th>Total Time</th>}i, output )
|
80
108
|
assert_match( /Object#run_primes/i, output )
|
81
109
|
end
|
82
|
-
|
110
|
+
|
83
111
|
def test_graph_string
|
84
112
|
output = ''
|
85
113
|
printer = RubyProf::GraphPrinter.new(@result)
|
@@ -89,42 +117,140 @@ class PrintersTest < Test::Unit::TestCase
|
|
89
117
|
assert_match( /Total Time: \d+\.\d+/i, output )
|
90
118
|
assert_match( /Object#run_primes/i, output )
|
91
119
|
end
|
92
|
-
|
120
|
+
|
93
121
|
def test_call_tree_string
|
94
122
|
output = ''
|
95
123
|
printer = RubyProf::CallTreePrinter.new(@result)
|
96
124
|
printer.print(output)
|
97
|
-
|
98
|
-
assert_match(/fn=Object::find_primes/i, output)
|
125
|
+
assert_match(/fn=Object#find_primes/i, output)
|
99
126
|
assert_match(/events: wall_time/i, output)
|
127
|
+
assert_no_match(/d\d\d\d\d\d/, output) # old bug looked [in error] like Object::run_primes(d5833116)
|
100
128
|
end
|
101
|
-
|
129
|
+
|
102
130
|
def do_nothing
|
103
131
|
start = Time.now
|
104
132
|
while(Time.now == start)
|
105
133
|
end
|
106
134
|
end
|
107
|
-
|
135
|
+
|
108
136
|
def test_all_with_small_percentiles
|
109
|
-
|
110
137
|
result = RubyProf.profile do
|
111
138
|
sleep 2
|
112
|
-
do_nothing
|
139
|
+
do_nothing
|
113
140
|
end
|
114
|
-
|
141
|
+
|
115
142
|
# RubyProf::CallTreePrinter doesn't "do" a min_percent
|
116
143
|
# RubyProf::FlatPrinter only outputs if self time > percent...
|
117
144
|
# RubyProf::FlatPrinterWithLineNumbers same
|
118
145
|
for klass in [ RubyProf::GraphPrinter, RubyProf::GraphHtmlPrinter]
|
119
|
-
puts klass
|
120
146
|
printer = klass.new(result)
|
121
147
|
out = ''
|
122
|
-
|
123
|
-
assert_match(/do_nothing/, out)
|
148
|
+
printer.print(out, :min_percent => 0.00000001 )
|
149
|
+
assert_match(/do_nothing/, out)
|
124
150
|
end
|
125
|
-
|
126
|
-
end
|
127
|
-
|
128
|
-
|
129
|
-
|
151
|
+
|
152
|
+
end
|
153
|
+
|
154
|
+
def test_flat_result_sorting_by_self_time_is_default
|
155
|
+
printer = RubyProf::FlatPrinter.new(@result)
|
156
|
+
|
157
|
+
printer.print(output = '')
|
158
|
+
self_times = flat_output_nth_column_values(output, 3)
|
159
|
+
|
160
|
+
assert_sorted self_times
|
161
|
+
end
|
162
|
+
|
163
|
+
def test_flat_result_sorting
|
164
|
+
printer = RubyProf::FlatPrinter.new(@result)
|
165
|
+
|
166
|
+
sort_method_with_column_number = {:total_time => 2, :self_time => 3, :wait_time => 4, :children_time => 5}
|
167
|
+
|
168
|
+
sort_method_with_column_number.each_pair do |sort_method, n|
|
169
|
+
printer.print(output = '', :sort_method => sort_method)
|
170
|
+
times = flat_output_nth_column_values(output, n)
|
171
|
+
assert_sorted times
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
def test_flat_result_with_line_numbers_sorting_by_self_time_is_default
|
176
|
+
printer = RubyProf::FlatPrinterWithLineNumbers.new(@result)
|
177
|
+
|
178
|
+
printer.print(output = '')
|
179
|
+
self_times = flat_output_nth_column_values(output, 3)
|
180
|
+
|
181
|
+
assert_sorted self_times
|
182
|
+
end
|
183
|
+
|
184
|
+
def test_flat_with_line_numbers_result_sorting
|
185
|
+
printer = RubyProf::FlatPrinterWithLineNumbers.new(@result)
|
186
|
+
|
187
|
+
sort_method_with_column_number = {:total_time => 2, :self_time => 3, :wait_time => 4, :children_time => 5}
|
188
|
+
|
189
|
+
sort_method_with_column_number.each_pair do |sort_method, n|
|
190
|
+
printer.print(output = '', :sort_method => sort_method)
|
191
|
+
times = flat_output_nth_column_values(output, n)
|
192
|
+
assert_sorted times
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
196
|
+
def test_graph_result_sorting_by_total_time_is_default
|
197
|
+
printer = RubyProf::GraphPrinter.new(@result)
|
198
|
+
printer.print(output = '')
|
199
|
+
total_times = graph_output_nth_column_values(output, 3)
|
200
|
+
|
201
|
+
assert_sorted total_times
|
202
|
+
end
|
203
|
+
|
204
|
+
def test_graph_results_sorting
|
205
|
+
printer = RubyProf::GraphPrinter.new(@result)
|
206
|
+
|
207
|
+
sort_method_with_column_number = {:total_time => 3, :self_time => 4, :wait_time => 5, :children_time => 6}
|
208
|
+
|
209
|
+
sort_method_with_column_number.each_pair do |sort_method, n|
|
210
|
+
printer.print(output = '', :sort_method => sort_method)
|
211
|
+
times = graph_output_nth_column_values(output, n)
|
212
|
+
assert_sorted times
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
def test_graph_html_result_sorting_by_total_time_is_default
|
217
|
+
printer = RubyProf::GraphHtmlPrinter.new(@result)
|
218
|
+
printer.print(output = '')
|
219
|
+
total_times = graph_html_output_nth_column_values(output, 3)
|
220
|
+
|
221
|
+
assert_sorted total_times
|
222
|
+
end
|
223
|
+
|
224
|
+
def test_graph_html_result_sorting
|
225
|
+
printer = RubyProf::GraphHtmlPrinter.new(@result)
|
226
|
+
|
227
|
+
sort_method_with_column_number = {:total_time => 3, :self_time => 4, :wait_time => 5, :children_time => 6}
|
228
|
+
|
229
|
+
sort_method_with_column_number.each_pair do |sort_method, n|
|
230
|
+
printer.print(output = '', :sort_method => sort_method)
|
231
|
+
times = graph_html_output_nth_column_values(output, n)
|
232
|
+
assert_sorted times
|
233
|
+
end
|
234
|
+
end
|
235
|
+
|
236
|
+
private
|
237
|
+
def flat_output_nth_column_values(output, n)
|
238
|
+
only_method_calls = output.split("\n").select { |line| line =~ /^ +\d+/ }
|
239
|
+
only_method_calls.collect { |line| line.split(/ +/)[n] }
|
240
|
+
end
|
241
|
+
|
242
|
+
def graph_output_nth_column_values(output, n)
|
243
|
+
only_root_calls = output.split("\n").select { |line| line =~ /^ +[\d\.]+%/ }
|
244
|
+
only_root_calls.collect { |line| line.split(/ +/)[n] }
|
245
|
+
end
|
246
|
+
|
247
|
+
def graph_html_output_nth_column_values(output, n)
|
248
|
+
only_root_calls = output.split('<tr class="method">')
|
249
|
+
only_root_calls.delete_at(0)
|
250
|
+
only_root_calls.collect {|line| line.scan(/[\d\.]+/)[n - 1] }
|
251
|
+
end
|
252
|
+
|
253
|
+
def assert_sorted array
|
254
|
+
assert_equal array, array.sort.reverse, "Array #{array.inspect} is not sorted"
|
255
|
+
end
|
130
256
|
end
|
data/test/recursive_test.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
|
2
|
+
# encoding: UTF-8
|
3
|
+
|
4
|
+
require File.expand_path('../test_helper', __FILE__)
|
4
5
|
|
5
6
|
def simple(n)
|
6
7
|
sleep(1)
|
@@ -34,13 +35,13 @@ class RecursiveTest < Test::Unit::TestCase
|
|
34
35
|
end
|
35
36
|
|
36
37
|
methods = result.threads.values.first.sort.reverse
|
37
|
-
|
38
|
+
|
38
39
|
if RUBY_VERSION < '1.9'
|
39
|
-
assert_equal(
|
40
|
+
assert_equal(5, methods.length) # includes Fixnum+, Fixnum==...
|
40
41
|
else
|
41
|
-
assert_equal(
|
42
|
+
assert_equal(3, methods.length) # which don't show up in 1.9
|
42
43
|
end
|
43
|
-
|
44
|
+
|
44
45
|
method = methods[0]
|
45
46
|
assert_equal('RecursiveTest#test_simple', method.full_name)
|
46
47
|
assert_equal(1, method.called)
|
@@ -56,13 +57,13 @@ class RecursiveTest < Test::Unit::TestCase
|
|
56
57
|
|
57
58
|
method = methods[1]
|
58
59
|
assert_equal('Object#simple', method.full_name)
|
59
|
-
assert_equal(
|
60
|
-
assert_in_delta(2, method.total_time, 0.
|
61
|
-
assert_in_delta(0, method.self_time, 0.
|
62
|
-
assert_in_delta(0, method.wait_time, 0.
|
63
|
-
assert_in_delta(2, method.children_time, 0.
|
60
|
+
assert_equal(2, method.called)
|
61
|
+
assert_in_delta(2, method.total_time, 0.05)
|
62
|
+
assert_in_delta(0, method.self_time, 0.05)
|
63
|
+
assert_in_delta(0, method.wait_time, 0.05)
|
64
|
+
assert_in_delta(2, method.children_time, 0.05)
|
64
65
|
|
65
|
-
assert_equal(
|
66
|
+
assert_equal(2, method.call_infos.length)
|
66
67
|
call_info = method.call_infos[0]
|
67
68
|
assert_equal('RecursiveTest#test_simple->Object#simple', call_info.call_sequence)
|
68
69
|
if RUBY_VERSION < '1.9'
|
@@ -70,13 +71,14 @@ class RecursiveTest < Test::Unit::TestCase
|
|
70
71
|
else
|
71
72
|
assert_equal(2, call_info.children.length)
|
72
73
|
end
|
74
|
+
|
73
75
|
method = methods[2]
|
74
76
|
assert_equal('Kernel#sleep', method.full_name)
|
75
77
|
assert_equal(2, method.called)
|
76
|
-
assert_in_delta(2, method.total_time, 0.
|
77
|
-
assert_in_delta(2, method.self_time, 0.
|
78
|
-
assert_in_delta(0, method.wait_time, 0.
|
79
|
-
assert_in_delta(0, method.children_time, 0.
|
78
|
+
assert_in_delta(2, method.total_time, 0.05)
|
79
|
+
assert_in_delta(2, method.self_time, 0.05)
|
80
|
+
assert_in_delta(0, method.wait_time, 0.05)
|
81
|
+
assert_in_delta(0, method.children_time, 0.05)
|
80
82
|
|
81
83
|
assert_equal(2, method.call_infos.length)
|
82
84
|
call_info = method.call_infos[0]
|
@@ -84,24 +86,11 @@ class RecursiveTest < Test::Unit::TestCase
|
|
84
86
|
assert_equal(0, call_info.children.length)
|
85
87
|
|
86
88
|
call_info = method.call_infos[1]
|
87
|
-
assert_equal('RecursiveTest#test_simple->Object#simple->Object#simple
|
89
|
+
assert_equal('RecursiveTest#test_simple->Object#simple->Object#simple->Kernel#sleep', call_info.call_sequence)
|
88
90
|
assert_equal(0, call_info.children.length)
|
89
91
|
|
90
|
-
method = methods[3]
|
91
|
-
assert_equal('Object#simple(d1)', method.full_name)
|
92
|
-
assert_equal(1, method.called)
|
93
|
-
assert_in_delta(1, method.total_time, 0.01)
|
94
|
-
assert_in_delta(0, method.self_time, 0.01)
|
95
|
-
assert_in_delta(0, method.wait_time, 0.01)
|
96
|
-
assert_in_delta(1, method.children_time, 0.01)
|
97
|
-
|
98
|
-
assert_equal(1, method.call_infos.length)
|
99
|
-
call_info = method.call_infos[0]
|
100
|
-
assert_equal('RecursiveTest#test_simple->Object#simple->Object#simple(d1)', call_info.call_sequence)
|
101
92
|
if RUBY_VERSION < '1.9'
|
102
|
-
|
103
|
-
|
104
|
-
method = methods[4]
|
93
|
+
method = methods[3]
|
105
94
|
assert_equal('Fixnum#-', method.full_name)
|
106
95
|
assert_equal(2, method.called)
|
107
96
|
assert_in_delta(0, method.total_time, 0.01)
|
@@ -115,10 +104,10 @@ class RecursiveTest < Test::Unit::TestCase
|
|
115
104
|
assert_equal(0, call_info.children.length)
|
116
105
|
|
117
106
|
call_info = method.call_infos[1]
|
118
|
-
assert_equal('RecursiveTest#test_simple->Object#simple->Object#simple
|
107
|
+
assert_equal('RecursiveTest#test_simple->Object#simple->Object#simple->Fixnum#-', call_info.call_sequence)
|
119
108
|
assert_equal(0, call_info.children.length)
|
120
109
|
|
121
|
-
method = methods[
|
110
|
+
method = methods[4]
|
122
111
|
assert_equal('Fixnum#==', method.full_name)
|
123
112
|
assert_equal(2, method.called)
|
124
113
|
assert_in_delta(0, method.total_time, 0.01)
|
@@ -132,11 +121,8 @@ class RecursiveTest < Test::Unit::TestCase
|
|
132
121
|
assert_equal(0, call_info.children.length)
|
133
122
|
|
134
123
|
call_info = method.call_infos[1]
|
135
|
-
assert_equal('RecursiveTest#test_simple->Object#simple->Object#simple
|
124
|
+
assert_equal('RecursiveTest#test_simple->Object#simple->Object#simple->Fixnum#==', call_info.call_sequence)
|
136
125
|
assert_equal(0, call_info.children.length)
|
137
|
-
|
138
|
-
else
|
139
|
-
assert_equal(1, call_info.children.length)
|
140
126
|
end
|
141
127
|
end
|
142
128
|
|
@@ -147,9 +133,9 @@ class RecursiveTest < Test::Unit::TestCase
|
|
147
133
|
|
148
134
|
methods = result.threads.values.first.sort.reverse
|
149
135
|
if RUBY_VERSION < '1.9'
|
150
|
-
assert_equal(
|
136
|
+
assert_equal(6, methods.length) # includes Fixnum+ and Fixnum==, which aren't included in 1.9
|
151
137
|
else
|
152
|
-
assert_equal(
|
138
|
+
assert_equal(4, methods.length) # which don't show up in 1.9
|
153
139
|
end
|
154
140
|
method = methods[0]
|
155
141
|
assert_equal('RecursiveTest#test_cycle', method.full_name)
|
@@ -166,26 +152,26 @@ class RecursiveTest < Test::Unit::TestCase
|
|
166
152
|
|
167
153
|
method = methods[1]
|
168
154
|
assert_equal('Object#cycle', method.full_name)
|
169
|
-
assert_equal(
|
155
|
+
assert_equal(2, method.called)
|
170
156
|
assert_in_delta(2, method.total_time, 0.05)
|
171
157
|
assert_in_delta(0, method.self_time, 0.01)
|
172
158
|
assert_in_delta(0, method.wait_time, 0.01)
|
173
159
|
assert_in_delta(2, method.children_time, 0.05)
|
174
160
|
|
175
|
-
assert_equal(
|
161
|
+
assert_equal(2, method.call_infos.length)
|
176
162
|
call_info = method.call_infos[0]
|
177
163
|
assert_equal('RecursiveTest#test_cycle->Object#cycle', call_info.call_sequence)
|
178
164
|
assert_equal(1, call_info.children.length)
|
179
165
|
|
180
166
|
method = methods[2]
|
181
167
|
assert_equal('Object#sub_cycle', method.full_name)
|
182
|
-
assert_equal(
|
168
|
+
assert_equal(2, method.called)
|
183
169
|
assert_in_delta(2, method.total_time, 0.05)
|
184
170
|
assert_in_delta(0, method.self_time, 0.05)
|
185
171
|
assert_in_delta(0, method.wait_time, 0.05)
|
186
172
|
assert_in_delta(2, method.children_time, 0.05)
|
187
173
|
|
188
|
-
assert_equal(
|
174
|
+
assert_equal(2, method.call_infos.length)
|
189
175
|
call_info = method.call_infos[0]
|
190
176
|
assert_equal('RecursiveTest#test_cycle->Object#cycle->Object#sub_cycle', call_info.call_sequence)
|
191
177
|
if RUBY_VERSION < '1.9'
|
@@ -208,33 +194,11 @@ class RecursiveTest < Test::Unit::TestCase
|
|
208
194
|
assert_equal(0, call_info.children.length)
|
209
195
|
|
210
196
|
call_info = method.call_infos[1]
|
211
|
-
assert_equal('RecursiveTest#test_cycle->Object#cycle->Object#sub_cycle->Object#cycle
|
197
|
+
assert_equal('RecursiveTest#test_cycle->Object#cycle->Object#sub_cycle->Object#cycle->Object#sub_cycle->Kernel#sleep', call_info.call_sequence)
|
212
198
|
assert_equal(0, call_info.children.length)
|
213
199
|
|
214
|
-
method = methods[4]
|
215
|
-
assert_equal('Object#cycle(d1)', method.full_name)
|
216
|
-
assert_equal(1, method.called)
|
217
|
-
assert_in_delta(1, method.total_time, 0.05)
|
218
|
-
assert_in_delta(0, method.self_time, 0.01)
|
219
|
-
assert_in_delta(0, method.wait_time, 0.01)
|
220
|
-
assert_in_delta(1, method.children_time, 0.05)
|
221
|
-
|
222
|
-
assert_equal(1, method.call_infos.length)
|
223
|
-
call_info = method.call_infos[0]
|
224
|
-
assert_equal('RecursiveTest#test_cycle->Object#cycle->Object#sub_cycle->Object#cycle(d1)', call_info.call_sequence)
|
225
|
-
assert_equal(1, call_info.children.length)
|
226
|
-
|
227
|
-
method = methods[5]
|
228
|
-
assert_equal('Object#sub_cycle(d1)', method.full_name)
|
229
|
-
assert_equal(1, method.called)
|
230
|
-
assert_in_delta(1, method.total_time, 0.01)
|
231
|
-
assert_in_delta(0, method.self_time, 0.01)
|
232
|
-
assert_in_delta(0, method.wait_time, 0.01)
|
233
|
-
call_info = method.call_infos[0]
|
234
|
-
assert_equal('RecursiveTest#test_cycle->Object#cycle->Object#sub_cycle->Object#cycle(d1)->Object#sub_cycle(d1)', call_info.call_sequence)
|
235
200
|
if RUBY_VERSION < '1.9'
|
236
|
-
|
237
|
-
method = methods[6]
|
201
|
+
method = methods[4]
|
238
202
|
assert_equal('Fixnum#-', method.full_name)
|
239
203
|
assert_equal(2, method.called)
|
240
204
|
assert_in_delta(0, method.total_time, 0.01)
|
@@ -248,10 +212,10 @@ class RecursiveTest < Test::Unit::TestCase
|
|
248
212
|
assert_equal(0, call_info.children.length)
|
249
213
|
|
250
214
|
call_info = method.call_infos[1]
|
251
|
-
assert_equal('RecursiveTest#test_cycle->Object#cycle->Object#sub_cycle->Object#cycle
|
215
|
+
assert_equal('RecursiveTest#test_cycle->Object#cycle->Object#sub_cycle->Object#cycle->Object#sub_cycle->Fixnum#-', call_info.call_sequence)
|
252
216
|
assert_equal(0, call_info.children.length)
|
253
217
|
|
254
|
-
method = methods[
|
218
|
+
method = methods[5]
|
255
219
|
assert_equal('Fixnum#==', method.full_name)
|
256
220
|
assert_equal(2, method.called)
|
257
221
|
assert_in_delta(0, method.total_time, 0.01)
|
@@ -265,10 +229,8 @@ class RecursiveTest < Test::Unit::TestCase
|
|
265
229
|
assert_equal(0, call_info.children.length)
|
266
230
|
|
267
231
|
call_info = method.call_infos[1]
|
268
|
-
assert_equal('RecursiveTest#test_cycle->Object#cycle->Object#sub_cycle->Object#cycle
|
232
|
+
assert_equal('RecursiveTest#test_cycle->Object#cycle->Object#sub_cycle->Object#cycle->Object#sub_cycle->Fixnum#==', call_info.call_sequence)
|
269
233
|
assert_equal(0, call_info.children.length)
|
270
|
-
else
|
271
|
-
assert_equal(1, call_info.children.length)
|
272
234
|
end
|
273
235
|
|
274
236
|
end
|