ruby-prof 0.11.0.rc1 → 0.11.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. data/CHANGES +20 -5
  2. data/README.rdoc +10 -3
  3. data/ext/ruby_prof/rp_call_info.c +108 -79
  4. data/ext/ruby_prof/rp_call_info.h +1 -0
  5. data/ext/ruby_prof/rp_measure_cpu_time.c +111 -111
  6. data/ext/ruby_prof/rp_measure_gc_runs.c +1 -1
  7. data/ext/ruby_prof/rp_measure_memory.c +1 -1
  8. data/ext/ruby_prof/rp_measure_process_time.c +71 -71
  9. data/ext/ruby_prof/rp_measure_wall_time.c +1 -1
  10. data/ext/ruby_prof/rp_method.c +143 -73
  11. data/ext/ruby_prof/rp_method.h +7 -4
  12. data/ext/ruby_prof/rp_stack.c +16 -1
  13. data/ext/ruby_prof/rp_stack.h +4 -1
  14. data/ext/ruby_prof/rp_thread.c +165 -35
  15. data/ext/ruby_prof/rp_thread.h +8 -2
  16. data/ext/ruby_prof/ruby_prof.c +164 -171
  17. data/ext/ruby_prof/ruby_prof.h +53 -54
  18. data/ext/ruby_prof/vc/ruby_prof.sln +26 -0
  19. data/ext/ruby_prof/vc/ruby_prof.vcxproj +109 -0
  20. data/ext/ruby_prof/vc/ruby_prof_18.vcxproj +105 -0
  21. data/lib/ruby-prof/aggregate_call_info.rb +9 -7
  22. data/lib/ruby-prof/call_info.rb +2 -27
  23. data/lib/ruby-prof/call_info_visitor.rb +42 -0
  24. data/lib/ruby-prof/{empty.png → images/empty.png} +0 -0
  25. data/lib/ruby-prof/{minus.png → images/minus.png} +0 -0
  26. data/lib/ruby-prof/{plus.png → images/plus.png} +0 -0
  27. data/lib/ruby-prof/method_info.rb +13 -15
  28. data/lib/ruby-prof/{abstract_printer.rb → printers/abstract_printer.rb} +36 -2
  29. data/lib/ruby-prof/printers/call_info_printer.rb +40 -0
  30. data/lib/ruby-prof/{call_stack_printer.rb → printers/call_stack_printer.rb} +11 -16
  31. data/lib/ruby-prof/{call_tree_printer.rb → printers/call_tree_printer.rb} +4 -4
  32. data/lib/ruby-prof/{dot_printer.rb → printers/dot_printer.rb} +11 -31
  33. data/lib/ruby-prof/{flat_printer.rb → printers/flat_printer.rb} +26 -35
  34. data/lib/ruby-prof/{flat_printer_with_line_numbers.rb → printers/flat_printer_with_line_numbers.rb} +14 -25
  35. data/lib/ruby-prof/printers/graph_html_printer.rb +248 -0
  36. data/lib/ruby-prof/{graph_printer.rb → printers/graph_printer.rb} +31 -73
  37. data/lib/ruby-prof/{multi_printer.rb → printers/multi_printer.rb} +0 -0
  38. data/lib/ruby-prof/profile.rb +27 -22
  39. data/lib/ruby-prof/rack.rb +22 -12
  40. data/ruby-prof.gemspec +58 -0
  41. data/test/aggregate_test.rb +6 -6
  42. data/test/call_info_visitor_test.rb +31 -0
  43. data/test/duplicate_names_test.rb +1 -1
  44. data/test/dynamic_method_test.rb +1 -1
  45. data/test/enumerable_test.rb +1 -1
  46. data/test/exclude_threads_test.rb +2 -2
  47. data/test/gc_test.rb +35 -0
  48. data/test/line_number_test.rb +2 -2
  49. data/test/measure_cpu_time_test.rb +5 -5
  50. data/test/measure_process_time_test.rb +5 -5
  51. data/test/measure_wall_time_test.rb +5 -5
  52. data/test/method_elimination_test.rb +3 -3
  53. data/test/module_test.rb +1 -1
  54. data/test/no_method_class_test.rb +1 -1
  55. data/test/printers_test.rb +16 -8
  56. data/test/recursive_test.rb +115 -91
  57. data/test/stack_test.rb +1 -1
  58. data/test/start_stop_test.rb +13 -13
  59. data/test/summarize_test.rb +48 -0
  60. data/test/test_suite.rb +1 -0
  61. data/test/thread_test.rb +16 -12
  62. data/test/unique_call_path_test.rb +10 -10
  63. metadata +64 -85
  64. data/lib/1.8/ruby_prof.so +0 -0
  65. data/lib/1.9/ruby_prof.exp +0 -0
  66. data/lib/1.9/ruby_prof.ilk +0 -0
  67. data/lib/1.9/ruby_prof.lib +0 -0
  68. data/lib/1.9/ruby_prof.pdb +0 -0
  69. data/lib/1.9/ruby_prof.so +0 -0
  70. data/lib/ruby-prof.rb +0 -70
  71. data/lib/ruby-prof/graph_html_printer.rb +0 -286
  72. data/lib/ruby-prof/symbol_to_proc.rb +0 -10
  73. data/lib/ruby_prof.exp +0 -0
  74. data/lib/ruby_prof.ilk +0 -0
  75. data/lib/ruby_prof.lib +0 -0
  76. data/lib/ruby_prof.pdb +0 -0
  77. data/lib/ruby_prof.so +0 -0
  78. data/lib/unprof.rb +0 -10
  79. data/test/do_nothing.rb +0 -0
@@ -28,7 +28,7 @@ class MeasureWallTimeTest < Test::Unit::TestCase
28
28
  # <Class::RubyProf::C1>#hello
29
29
  # Kernel#sleep
30
30
 
31
- methods = result.threads.values.first.sort.reverse
31
+ methods = result.threads.first.methods.sort.reverse
32
32
  assert_equal(3, methods.length)
33
33
 
34
34
  # Check the names
@@ -63,7 +63,7 @@ class MeasureWallTimeTest < Test::Unit::TestCase
63
63
  # C1#hello
64
64
  # Kernel#sleep
65
65
 
66
- methods = result.threads.values.first.sort.reverse
66
+ methods = result.threads.first.methods.sort.reverse
67
67
  assert_equal(6, methods.length)
68
68
  names = methods.map(&:full_name)
69
69
  assert_equal('MeasureWallTimeTest#test_instance_methods', names[0])
@@ -110,7 +110,7 @@ class MeasureWallTimeTest < Test::Unit::TestCase
110
110
  # M1#hello
111
111
  # Kernel#sleep
112
112
 
113
- methods = result.threads.values.first.sort.reverse
113
+ methods = result.threads.first.methods.sort.reverse
114
114
  assert_equal(3, methods.length)
115
115
 
116
116
  assert_equal('MeasureWallTimeTest#test_module_methods', methods[0].full_name)
@@ -144,7 +144,7 @@ class MeasureWallTimeTest < Test::Unit::TestCase
144
144
  # M1#hello
145
145
  # Kernel#sleep
146
146
 
147
- methods = result.threads.values.first.sort.reverse
147
+ methods = result.threads.first.methods.sort.reverse
148
148
  assert_equal(6, methods.length)
149
149
  names = methods.map(&:full_name)
150
150
  assert_equal('MeasureWallTimeTest#test_module_instance_methods', names[0])
@@ -192,7 +192,7 @@ class MeasureWallTimeTest < Test::Unit::TestCase
192
192
  c3.hello
193
193
  end
194
194
 
195
- methods = result.threads.values.first.sort.reverse
195
+ methods = result.threads.first.methods.sort.reverse
196
196
  assert_equal(2, methods.length)
197
197
 
198
198
  assert_equal('MeasureWallTimeTest#test_singleton', methods[0].full_name)
@@ -37,7 +37,7 @@ class MethodEliminationTest < Test::Unit::TestCase
37
37
  result = RubyProf.profile do
38
38
  1000.times { 1+1 }
39
39
  end
40
- method_infos = result.threads.values.first
40
+ method_infos = result.threads.first.methods
41
41
  assert(m1 = method_infos[0])
42
42
  assert(c1 = m1.call_infos.first)
43
43
  assert_equal(c1, c1.parent = c1)
@@ -59,8 +59,8 @@ class MethodEliminationTest < Test::Unit::TestCase
59
59
 
60
60
  private
61
61
  def assert_method_has_been_eliminated(result, eliminated_method)
62
- result.threads.each do |thread_id, methods|
63
- methods.each do |method|
62
+ result.threads.each do |thread|
63
+ thread.methods.each do |method|
64
64
  method.call_infos.each do |ci|
65
65
  assert(ci.target != eliminated_method, "broken self")
66
66
  assert(ci.parent.target != eliminated_method, "broken parent") if ci.parent
data/test/module_test.rb CHANGED
@@ -32,7 +32,7 @@ class ModuleTest < Test::Unit::TestCase
32
32
  hello
33
33
  end
34
34
 
35
- methods = result.threads.values.first
35
+ methods = result.threads.first.methods
36
36
 
37
37
  # Length should be 5
38
38
  assert_equal(5, methods.length)
@@ -8,7 +8,7 @@ result = RubyProf.profile do
8
8
  sleep 1
9
9
  end
10
10
 
11
- methods = result.threads.values.first
11
+ methods = result.threads.first.methods
12
12
  global_method = methods.sort_by {|method| method.full_name}.first
13
13
  if global_method.full_name != 'Global#[No method]'
14
14
  raise(RuntimeError, "Wrong method name. Expected: Global#[No method]. Actual: #{global_method.full_name}")
@@ -7,13 +7,13 @@ require 'fileutils'
7
7
 
8
8
  # -- Tests ----
9
9
  class PrintersTest < Test::Unit::TestCase
10
-
11
10
  def go
12
11
  run_primes(1000)
13
12
  end
14
13
 
15
14
  def setup
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
+ # WALL_TIME so we can use sleep in our test and get same measurements on linux and windows
16
+ RubyProf::measure_mode = RubyProf::WALL_TIME
17
17
  @result = RubyProf.profile do
18
18
  begin
19
19
  run_primes(1000)
@@ -22,13 +22,18 @@ class PrintersTest < Test::Unit::TestCase
22
22
  p e
23
23
  end
24
24
  end
25
-
26
25
  end
27
26
 
28
27
  def test_printers
29
28
  assert_nothing_raised do
30
29
  output = ENV['SHOW_RUBY_PROF_PRINTER_OUTPUT'] == "1" ? STDOUT : StringIO.new('')
31
30
 
31
+ printer = RubyProf::CallInfoPrinter.new(@result)
32
+ printer.print(output)
33
+
34
+ printer = RubyProf::CallTreePrinter.new(@result)
35
+ printer.print(output)
36
+
32
37
  printer = RubyProf::FlatPrinter.new(@result)
33
38
  printer.print(output)
34
39
 
@@ -41,8 +46,11 @@ class PrintersTest < Test::Unit::TestCase
41
46
  printer = RubyProf::GraphPrinter.new(@result)
42
47
  printer.print(output)
43
48
 
44
- printer = RubyProf::CallTreePrinter.new(@result)
45
- printer.print(output)
49
+ end
50
+ end
51
+
52
+ def test_print_to_files
53
+ assert_nothing_raised do
46
54
  output_dir = 'examples2'
47
55
 
48
56
  if ENV['SAVE_NEW_PRINTER_EXAMPLES']
@@ -66,11 +74,11 @@ class PrintersTest < Test::Unit::TestCase
66
74
  end
67
75
 
68
76
  def test_flat_string
69
- output = helper_test_flat_string RubyProf::FlatPrinter
77
+ output = helper_test_flat_string(RubyProf::FlatPrinter)
70
78
  assert_no_match(/prime.rb/, output)
71
79
  end
72
80
 
73
- def helper_test_flat_string klass
81
+ def helper_test_flat_string(klass)
74
82
  output = ''
75
83
 
76
84
  printer = klass.new(@result)
@@ -145,7 +153,7 @@ class PrintersTest < Test::Unit::TestCase
145
153
  for klass in [ RubyProf::GraphPrinter, RubyProf::GraphHtmlPrinter]
146
154
  printer = klass.new(result)
147
155
  out = ''
148
- printer.print(out, :min_percent => 0.00000001 )
156
+ printer.print(out, :min_percent => 0.00000001)
149
157
  assert_match(/do_nothing/, out)
150
158
  end
151
159
 
@@ -3,6 +3,7 @@
3
3
 
4
4
  require File.expand_path('../test_helper', __FILE__)
5
5
 
6
+ # Simple recursive test
6
7
  def simple(n)
7
8
  sleep(1)
8
9
  n -= 1
@@ -10,17 +11,25 @@ def simple(n)
10
11
  simple(n)
11
12
  end
12
13
 
13
- def cycle(n)
14
- sub_cycle(n)
15
- end
16
14
 
17
- def sub_cycle(n)
15
+ # More complicated recursive test
16
+ def render_partial(i)
18
17
  sleep(1)
19
- n -= 1
20
- return if n == 0
21
- cycle(n)
18
+ case i
19
+ when 0
20
+ render_partial(10)
21
+ when 1
22
+ 2.times do |j|
23
+ render_partial(j + 10)
24
+ end
25
+ end
22
26
  end
23
27
 
28
+ def render
29
+ 2.times do |i|
30
+ render_partial(i)
31
+ end
32
+ end
24
33
 
25
34
  # -- Tests ----
26
35
  class RecursiveTest < Test::Unit::TestCase
@@ -34,60 +43,73 @@ class RecursiveTest < Test::Unit::TestCase
34
43
  simple(2)
35
44
  end
36
45
 
37
- methods = result.threads.values.first.sort.reverse
46
+ methods = result.threads.first.methods.dup
38
47
 
39
- if RUBY_VERSION < '1.9'
40
- assert_equal(5, methods.length) # includes Fixnum+, Fixnum==...
41
- else
42
- assert_equal(3, methods.length) # which don't show up in 1.9
48
+ # Remove Fixnum+, Fixnum== for less than Ruby 1.9
49
+ methods.delete_if do |method|
50
+ method.full_name.match(/Fixnum/)
43
51
  end
44
52
 
53
+ assert_equal(3, methods.length) # which don't show up in 1.9
54
+
55
+ # Method 0: RecursiveTest#test_simple
45
56
  method = methods[0]
46
57
  assert_equal('RecursiveTest#test_simple', method.full_name)
47
58
  assert_equal(1, method.called)
48
- assert_in_delta(2, method.total_time, 0.05)
59
+ assert_in_delta(2, method.total_time, 0.1)
49
60
  assert_in_delta(0, method.self_time, 0.01)
50
61
  assert_in_delta(0, method.wait_time, 0.01)
51
- assert_in_delta(2, method.children_time, 0.05)
62
+ assert_in_delta(2, method.children_time, 0.1)
52
63
 
53
64
  assert_equal(1, method.call_infos.length)
54
65
  call_info = method.call_infos[0]
66
+ assert(!call_info.recursive)
55
67
  assert_equal('RecursiveTest#test_simple', call_info.call_sequence)
56
68
  assert_equal(1, call_info.children.length)
57
69
 
70
+ # Method 1: Object#simple
58
71
  method = methods[1]
59
72
  assert_equal('Object#simple', method.full_name)
60
73
  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)
74
+ assert_in_delta(2, method.total_time, 0.1)
75
+ assert_in_delta(0, method.self_time, 0.1)
76
+ assert_in_delta(0, method.wait_time, 0.1)
77
+ assert_in_delta(2, method.children_time, 0.1)
65
78
 
66
79
  assert_equal(2, method.call_infos.length)
67
- call_info = method.call_infos[0]
68
- assert_equal('RecursiveTest#test_simple->Object#simple', call_info.call_sequence)
80
+
81
+ call_info = method.call_infos.first
69
82
  if RUBY_VERSION < '1.9'
70
83
  assert_equal(4, call_info.children.length)
71
84
  else
72
85
  assert_equal(2, call_info.children.length)
73
86
  end
87
+ assert_equal('RecursiveTest#test_simple->Object#simple', call_info.call_sequence)
88
+ assert(!call_info.recursive)
89
+
90
+ call_info = method.call_infos.last
91
+ assert_equal(1, call_info.children.length)
92
+ assert_equal('RecursiveTest#test_simple->Object#simple->Object#simple', call_info.call_sequence)
93
+ assert(call_info.recursive)
74
94
 
75
95
  method = methods[2]
76
96
  assert_equal('Kernel#sleep', method.full_name)
77
97
  assert_equal(2, method.called)
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)
98
+ assert_in_delta(2, method.total_time, 0.1)
99
+ assert_in_delta(2, method.self_time, 0.1)
100
+ assert_in_delta(0, method.wait_time, 0.1)
101
+ assert_in_delta(0, method.children_time, 0.1)
82
102
 
83
103
  assert_equal(2, method.call_infos.length)
84
104
  call_info = method.call_infos[0]
85
105
  assert_equal('RecursiveTest#test_simple->Object#simple->Kernel#sleep', call_info.call_sequence)
86
106
  assert_equal(0, call_info.children.length)
107
+ assert(!call_info.recursive)
87
108
 
88
109
  call_info = method.call_infos[1]
89
110
  assert_equal('RecursiveTest#test_simple->Object#simple->Object#simple->Kernel#sleep', call_info.call_sequence)
90
111
  assert_equal(0, call_info.children.length)
112
+ assert(!call_info.recursive)
91
113
 
92
114
  if RUBY_VERSION < '1.9'
93
115
  method = methods[3]
@@ -128,110 +150,112 @@ class RecursiveTest < Test::Unit::TestCase
128
150
 
129
151
  def test_cycle
130
152
  result = RubyProf.profile do
131
- cycle(2)
153
+ render
132
154
  end
133
155
 
134
- methods = result.threads.values.first.sort.reverse
135
- if RUBY_VERSION < '1.9'
136
- assert_equal(6, methods.length) # includes Fixnum+ and Fixnum==, which aren't included in 1.9
156
+ printer = RubyProf::GraphPrinter.new(result)
157
+ printer.print(STDOUT)
158
+
159
+ methods = result.threads.first.methods.sort.reverse
160
+ if RUBY_VERSION < '1.9' # Fixnum#+, Fixnum#===, Kernel#===
161
+ assert_equal(8, methods.length)
137
162
  else
138
- assert_equal(4, methods.length) # which don't show up in 1.9
163
+ assert_equal(5, methods.length)
139
164
  end
165
+
140
166
  method = methods[0]
141
167
  assert_equal('RecursiveTest#test_cycle', method.full_name)
142
168
  assert_equal(1, method.called)
143
- assert_in_delta(2, method.total_time, 0.05)
169
+ assert_in_delta(5, method.total_time, 0.1)
144
170
  assert_in_delta(0, method.self_time, 0.01)
145
171
  assert_in_delta(0, method.wait_time, 0.01)
146
- assert_in_delta(2, method.children_time, 0.05)
172
+ assert_in_delta(5, method.children_time, 0.1)
147
173
 
148
174
  assert_equal(1, method.call_infos.length)
149
175
  call_info = method.call_infos[0]
150
176
  assert_equal('RecursiveTest#test_cycle', call_info.call_sequence)
151
177
  assert_equal(1, call_info.children.length)
178
+ assert(!call_info.recursive)
152
179
 
153
180
  method = methods[1]
154
- assert_equal('Object#cycle', method.full_name)
155
- assert_equal(2, method.called)
156
- assert_in_delta(2, method.total_time, 0.05)
181
+ assert_equal('Object#render', method.full_name)
182
+ assert_equal(1, method.called)
183
+ assert_in_delta(5, method.total_time, 0.1)
157
184
  assert_in_delta(0, method.self_time, 0.01)
158
185
  assert_in_delta(0, method.wait_time, 0.01)
159
- assert_in_delta(2, method.children_time, 0.05)
186
+ assert_in_delta(5, method.children_time, 0.1)
160
187
 
161
- assert_equal(2, method.call_infos.length)
188
+ assert_equal(1, method.call_infos.length)
162
189
  call_info = method.call_infos[0]
163
- assert_equal('RecursiveTest#test_cycle->Object#cycle', call_info.call_sequence)
190
+ assert_equal('RecursiveTest#test_cycle->Object#render', call_info.call_sequence)
164
191
  assert_equal(1, call_info.children.length)
192
+ assert(!call_info.recursive)
165
193
 
166
194
  method = methods[2]
167
- assert_equal('Object#sub_cycle', method.full_name)
195
+ assert_equal('Integer#times', method.full_name)
168
196
  assert_equal(2, method.called)
169
- assert_in_delta(2, method.total_time, 0.05)
170
- assert_in_delta(0, method.self_time, 0.05)
171
- assert_in_delta(0, method.wait_time, 0.05)
172
- assert_in_delta(2, method.children_time, 0.05)
197
+ assert_in_delta(5, method.total_time, 0.1)
198
+ assert_in_delta(0, method.self_time, 0.1)
199
+ assert_in_delta(0, method.wait_time, 0.1)
200
+ assert_in_delta(5, method.children_time, 0.1)
173
201
 
174
202
  assert_equal(2, method.call_infos.length)
175
203
  call_info = method.call_infos[0]
176
- assert_equal('RecursiveTest#test_cycle->Object#cycle->Object#sub_cycle', call_info.call_sequence)
177
- if RUBY_VERSION < '1.9'
178
- assert_equal(4, call_info.children.length)
179
- else
180
- assert_equal(2, call_info.children.length)
181
- end
204
+ assert_equal('RecursiveTest#test_cycle->Object#render->Integer#times', call_info.call_sequence)
205
+ assert_equal(1, call_info.children.length)
206
+ assert(!call_info.recursive)
207
+
208
+ call_info = method.call_infos[1]
209
+ assert_equal('RecursiveTest#test_cycle->Object#render->Integer#times->Object#render_partial->Integer#times', call_info.call_sequence)
210
+ assert_equal(1, call_info.children.length)
211
+ assert(call_info.recursive)
182
212
 
183
213
  method = methods[3]
184
- assert_equal('Kernel#sleep', method.full_name)
185
- assert_equal(2, method.called)
186
- assert_in_delta(2, method.total_time, 0.05)
187
- assert_in_delta(2, method.self_time, 0.05)
214
+ assert_equal('Object#render_partial', method.full_name)
215
+ assert_equal(5, method.called)
216
+ assert_in_delta(5, method.total_time, 0.1)
217
+ assert_in_delta(0, method.self_time, 0.1)
188
218
  assert_in_delta(0, method.wait_time, 0.01)
189
- assert_in_delta(0, method.children_time, 0.01)
219
+ assert_in_delta(5, method.children_time, 0.01)
190
220
 
191
- assert_equal(2, method.call_infos.length)
221
+ assert_equal(3, method.call_infos.length)
192
222
  call_info = method.call_infos[0]
193
- assert_equal('RecursiveTest#test_cycle->Object#cycle->Object#sub_cycle->Kernel#sleep', call_info.call_sequence)
194
- assert_equal(0, call_info.children.length)
223
+ assert_equal('RecursiveTest#test_cycle->Object#render->Integer#times->Object#render_partial', call_info.call_sequence)
224
+ assert_equal(3, call_info.children.length)
225
+ assert(!call_info.recursive)
195
226
 
196
227
  call_info = method.call_infos[1]
197
- assert_equal('RecursiveTest#test_cycle->Object#cycle->Object#sub_cycle->Object#cycle->Object#sub_cycle->Kernel#sleep', call_info.call_sequence)
198
- assert_equal(0, call_info.children.length)
199
-
200
- if RUBY_VERSION < '1.9'
201
- method = methods[4]
202
- assert_equal('Fixnum#-', method.full_name)
203
- assert_equal(2, method.called)
204
- assert_in_delta(0, method.total_time, 0.01)
205
- assert_in_delta(0, method.self_time, 0.01)
206
- assert_in_delta(0, method.wait_time, 0.01)
207
- assert_in_delta(0, method.children_time, 0.01)
208
-
209
- assert_equal(2, method.call_infos.length)
210
- call_info = method.call_infos[0]
211
- assert_equal('RecursiveTest#test_cycle->Object#cycle->Object#sub_cycle->Fixnum#-', call_info.call_sequence)
212
- assert_equal(0, call_info.children.length)
228
+ assert_equal('RecursiveTest#test_cycle->Object#render->Integer#times->Object#render_partial->Object#render_partial', call_info.call_sequence)
229
+ assert_equal(1, call_info.children.length)
230
+ assert(call_info.recursive)
213
231
 
214
- call_info = method.call_infos[1]
215
- assert_equal('RecursiveTest#test_cycle->Object#cycle->Object#sub_cycle->Object#cycle->Object#sub_cycle->Fixnum#-', call_info.call_sequence)
216
- assert_equal(0, call_info.children.length)
232
+ call_info = method.call_infos[2]
233
+ assert_equal('RecursiveTest#test_cycle->Object#render->Integer#times->Object#render_partial->Integer#times->Object#render_partial', call_info.call_sequence)
234
+ assert_equal(1, call_info.children.length)
235
+ assert(call_info.recursive)
217
236
 
218
- method = methods[5]
219
- assert_equal('Fixnum#==', method.full_name)
220
- assert_equal(2, method.called)
221
- assert_in_delta(0, method.total_time, 0.01)
222
- assert_in_delta(0, method.self_time, 0.01)
223
- assert_in_delta(0, method.wait_time, 0.01)
224
- assert_in_delta(0, method.children_time, 0.01)
237
+ method = methods[4]
238
+ assert_equal('Kernel#sleep', method.full_name)
239
+ assert_equal(5, method.called)
240
+ assert_in_delta(5, method.total_time, 0.1)
241
+ assert_in_delta(5, method.self_time, 0.1)
242
+ assert_in_delta(0, method.wait_time, 0.01)
243
+ assert_in_delta(0, method.children_time, 0.01)
225
244
 
226
- assert_equal(2, method.call_infos.length)
227
- call_info = method.call_infos[0]
228
- assert_equal('RecursiveTest#test_cycle->Object#cycle->Object#sub_cycle->Fixnum#==', call_info.call_sequence)
229
- assert_equal(0, call_info.children.length)
245
+ assert_equal(3, method.call_infos.length)
246
+ call_info = method.call_infos[0]
247
+ assert_equal('RecursiveTest#test_cycle->Object#render->Integer#times->Object#render_partial->Kernel#sleep', call_info.call_sequence)
248
+ assert_equal(0, call_info.children.length)
249
+ assert(!call_info.recursive)
230
250
 
231
- call_info = method.call_infos[1]
232
- assert_equal('RecursiveTest#test_cycle->Object#cycle->Object#sub_cycle->Object#cycle->Object#sub_cycle->Fixnum#==', call_info.call_sequence)
233
- assert_equal(0, call_info.children.length)
234
- end
251
+ call_info = method.call_infos[1]
252
+ assert_equal('RecursiveTest#test_cycle->Object#render->Integer#times->Object#render_partial->Object#render_partial->Kernel#sleep', call_info.call_sequence)
253
+ assert_equal(0, call_info.children.length)
254
+ assert(!call_info.recursive)
235
255
 
256
+ call_info = method.call_infos[2]
257
+ assert_equal('RecursiveTest#test_cycle->Object#render->Integer#times->Object#render_partial->Integer#times->Object#render_partial->Kernel#sleep', call_info.call_sequence)
258
+ assert_equal(0, call_info.children.length)
259
+ assert(!call_info.recursive)
236
260
  end
237
- end
261
+ end