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.
Files changed (119) hide show
  1. data/CHANGES +89 -13
  2. data/LICENSE +4 -3
  3. data/{README → README.rdoc} +155 -162
  4. data/Rakefile +50 -123
  5. data/bin/ruby-prof +86 -47
  6. data/examples/empty.png +0 -0
  7. data/examples/graph.dot +106 -0
  8. data/examples/graph.png +0 -0
  9. data/examples/minus.png +0 -0
  10. data/examples/multi.flat.txt +23 -0
  11. data/examples/multi.graph.html +906 -0
  12. data/examples/multi.grind.dat +194 -0
  13. data/examples/multi.stack.html +573 -0
  14. data/examples/plus.png +0 -0
  15. data/examples/stack.html +573 -0
  16. data/ext/ruby_prof/extconf.rb +53 -0
  17. data/ext/ruby_prof/rp_call_info.c +369 -0
  18. data/ext/ruby_prof/rp_call_info.h +46 -0
  19. data/ext/ruby_prof/rp_measure.c +48 -0
  20. data/ext/ruby_prof/rp_measure.h +45 -0
  21. data/ext/ruby_prof/rp_measure_allocations.c +86 -0
  22. data/ext/ruby_prof/rp_measure_cpu_time.c +112 -0
  23. data/ext/ruby_prof/rp_measure_gc_runs.c +87 -0
  24. data/ext/ruby_prof/rp_measure_gc_time.c +73 -0
  25. data/ext/ruby_prof/rp_measure_memory.c +81 -0
  26. data/ext/ruby_prof/rp_measure_process_time.c +71 -0
  27. data/ext/ruby_prof/rp_measure_wall_time.c +42 -0
  28. data/ext/ruby_prof/rp_method.c +363 -0
  29. data/ext/ruby_prof/rp_method.h +55 -0
  30. data/ext/ruby_prof/rp_stack.c +61 -0
  31. data/ext/ruby_prof/rp_stack.h +40 -0
  32. data/ext/ruby_prof/rp_thread.c +113 -0
  33. data/ext/ruby_prof/rp_thread.h +20 -0
  34. data/ext/ruby_prof/ruby_prof.c +332 -1377
  35. data/ext/ruby_prof/ruby_prof.h +54 -188
  36. data/ext/ruby_prof/version.h +6 -3
  37. data/lib/1.8/ruby_prof.so +0 -0
  38. data/lib/1.9/ruby_prof.exp +0 -0
  39. data/lib/1.9/ruby_prof.ilk +0 -0
  40. data/lib/1.9/ruby_prof.lib +0 -0
  41. data/lib/1.9/ruby_prof.pdb +0 -0
  42. data/lib/1.9/ruby_prof.so +0 -0
  43. data/lib/ruby-prof.rb +32 -18
  44. data/lib/ruby-prof/abstract_printer.rb +15 -5
  45. data/lib/ruby-prof/aggregate_call_info.rb +11 -3
  46. data/lib/ruby-prof/call_info.rb +68 -1
  47. data/lib/ruby-prof/call_stack_printer.rb +775 -0
  48. data/lib/ruby-prof/call_tree_printer.rb +17 -9
  49. data/lib/ruby-prof/compatibility.rb +134 -0
  50. data/lib/ruby-prof/dot_printer.rb +152 -0
  51. data/lib/ruby-prof/empty.png +0 -0
  52. data/lib/ruby-prof/flat_printer.rb +23 -24
  53. data/lib/ruby-prof/flat_printer_with_line_numbers.rb +17 -21
  54. data/lib/ruby-prof/graph_html_printer.rb +69 -39
  55. data/lib/ruby-prof/graph_printer.rb +35 -35
  56. data/lib/ruby-prof/method_info.rb +26 -4
  57. data/lib/ruby-prof/minus.png +0 -0
  58. data/lib/ruby-prof/multi_printer.rb +56 -0
  59. data/lib/ruby-prof/plus.png +0 -0
  60. data/lib/ruby-prof/profile.rb +72 -0
  61. data/lib/ruby-prof/rack.rb +31 -0
  62. data/lib/ruby-prof/symbol_to_proc.rb +3 -1
  63. data/lib/ruby-prof/task.rb +20 -19
  64. data/lib/ruby-prof/test.rb +5 -3
  65. data/lib/ruby_prof.exp +0 -0
  66. data/lib/ruby_prof.ilk +0 -0
  67. data/lib/ruby_prof.lib +0 -0
  68. data/lib/ruby_prof.pdb +0 -0
  69. data/lib/ruby_prof.so +0 -0
  70. data/lib/unprof.rb +2 -0
  71. data/test/aggregate_test.rb +29 -14
  72. data/test/basic_test.rb +3 -251
  73. data/test/bug_test.rb +6 -0
  74. data/test/duplicate_names_test.rb +4 -4
  75. data/test/dynamic_method_test.rb +61 -0
  76. data/test/enumerable_test.rb +4 -4
  77. data/test/exceptions_test.rb +6 -5
  78. data/test/exclude_threads_test.rb +47 -47
  79. data/test/exec_test.rb +5 -5
  80. data/test/line_number_test.rb +16 -16
  81. data/test/measure_allocations_test.rb +25 -0
  82. data/test/measure_cpu_time_test.rb +212 -0
  83. data/test/measure_gc_runs_test.rb +29 -0
  84. data/test/measure_gc_time_test.rb +29 -0
  85. data/test/measure_memory_test.rb +36 -0
  86. data/test/measure_process_time_test.rb +205 -0
  87. data/test/measure_wall_time_test.rb +209 -0
  88. data/test/method_elimination_test.rb +74 -0
  89. data/test/module_test.rb +12 -21
  90. data/test/multi_printer_test.rb +81 -0
  91. data/test/no_method_class_test.rb +5 -3
  92. data/test/prime.rb +7 -10
  93. data/test/prime_test.rb +3 -3
  94. data/test/printers_test.rb +180 -54
  95. data/test/recursive_test.rb +34 -72
  96. data/test/singleton_test.rb +5 -4
  97. data/test/stack_printer_test.rb +73 -0
  98. data/test/stack_test.rb +7 -7
  99. data/test/start_stop_test.rb +23 -6
  100. data/test/test_helper.rb +81 -0
  101. data/test/test_suite.rb +35 -21
  102. data/test/thread_test.rb +40 -39
  103. data/test/unique_call_path_test.rb +6 -6
  104. metadata +106 -51
  105. data/ext/ruby_prof/measure_allocations.h +0 -58
  106. data/ext/ruby_prof/measure_cpu_time.h +0 -152
  107. data/ext/ruby_prof/measure_gc_runs.h +0 -76
  108. data/ext/ruby_prof/measure_gc_time.h +0 -57
  109. data/ext/ruby_prof/measure_memory.h +0 -101
  110. data/ext/ruby_prof/measure_process_time.h +0 -52
  111. data/ext/ruby_prof/measure_wall_time.h +0 -53
  112. data/ext/ruby_prof/mingw/Rakefile +0 -23
  113. data/ext/ruby_prof/mingw/build.rake +0 -38
  114. data/rails/environment/profile.rb +0 -24
  115. data/rails/example/example_test.rb +0 -9
  116. data/rails/profile_test_helper.rb +0 -21
  117. data/test/current_failures_windows +0 -8
  118. data/test/measurement_test.rb +0 -121
  119. data/test/ruby-prof-bin +0 -20
data/test/prime_test.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
- require 'test/unit'
3
- require 'ruby-prof'
4
- require 'prime'
2
+ # encoding: UTF-8
3
+
4
+ require File.expand_path('../test_helper', __FILE__)
5
5
 
6
6
  # -- Tests ----
7
7
  class PrimeTest< Test::Unit::TestCase
@@ -1,40 +1,68 @@
1
1
  #!/usr/bin/env ruby
2
- require 'test/unit'
3
- require 'ruby-prof'
4
- require File.dirname(__FILE__) + '/prime'
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
- run_primes
17
- go
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
- printer = RubyProf::FlatPrinter.new(@result)
24
- printer.print(STDOUT)
25
-
26
- printer = RubyProf::FlatPrinterWithLineNumbers.new(@result)
27
- printer.print(STDOUT)
28
-
29
- printer = RubyProf::GraphHtmlPrinter.new(@result)
30
- printer.print
31
-
32
- printer = RubyProf::GraphPrinter.new(@result)
33
- printer.print
34
-
35
- printer = RubyProf::CallTreePrinter.new(@result)
36
- printer.print(STDOUT)
37
- # we should get here
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
- assert_equal(3, output.scan(/Object#is_prime/).length)
66
- else
67
- # 1.9
68
- assert_equal(2, output.scan(/Object#is_prime/).length)
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
- assert_no_match(/\.\/test\/prime.rb/, output) # don't use relative paths
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
- output = printer.print(out, :min_percent => 0.00000001 )
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
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
- require 'test/unit'
3
- require 'ruby-prof'
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(6, methods.length) # includes Fixnum+, Fixnum==...
40
+ assert_equal(5, methods.length) # includes Fixnum+, Fixnum==...
40
41
  else
41
- assert_equal(4, methods.length)
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(1, method.called)
60
- assert_in_delta(2, method.total_time, 0.02)
61
- assert_in_delta(0, method.self_time, 0.02)
62
- assert_in_delta(0, method.wait_time, 0.02)
63
- assert_in_delta(2, method.children_time, 0.02)
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(1, method.call_infos.length)
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.01)
77
- assert_in_delta(2, method.self_time, 0.01)
78
- assert_in_delta(0, method.wait_time, 0.01)
79
- assert_in_delta(0, method.children_time, 0.01)
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(d1)->Kernel#sleep', call_info.call_sequence)
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
- assert_equal(3, call_info.children.length)
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(d1)->Fixnum#-', call_info.call_sequence)
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[5]
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(d1)->Fixnum#==', call_info.call_sequence)
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(8, methods.length) # includes Fixnum+ and Fixnum==, which aren't included in 1.9
136
+ assert_equal(6, methods.length) # includes Fixnum+ and Fixnum==, which aren't included in 1.9
151
137
  else
152
- assert_equal(6, methods.length)
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(1, method.called)
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(1, method.call_infos.length)
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(1, method.called)
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(1, method.call_infos.length)
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(d1)->Object#sub_cycle(d1)->Kernel#sleep', call_info.call_sequence)
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
- assert_equal(3, call_info.children.length)
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(d1)->Object#sub_cycle(d1)->Fixnum#-', call_info.call_sequence)
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[7]
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(d1)->Object#sub_cycle(d1)->Fixnum#==', call_info.call_sequence)
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