ruby-prof 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. data/CHANGES +54 -1
  2. data/README +134 -7
  3. data/Rakefile +40 -58
  4. data/bin/ruby-prof +21 -6
  5. data/ext/extconf.rb +13 -0
  6. data/ext/measure_allocations.h +16 -1
  7. data/ext/measure_cpu_time.h +15 -3
  8. data/ext/measure_gc_runs.h +76 -0
  9. data/ext/measure_gc_time.h +57 -0
  10. data/ext/measure_memory.h +61 -2
  11. data/ext/measure_process_time.h +13 -2
  12. data/ext/measure_wall_time.h +12 -1
  13. data/ext/mingw/Rakefile +23 -0
  14. data/ext/mingw/build.rake +38 -0
  15. data/ext/ruby_prof.c +685 -633
  16. data/ext/ruby_prof.h +188 -0
  17. data/ext/vc/ruby_prof.sln +20 -0
  18. data/ext/vc/ruby_prof.vcproj +241 -0
  19. data/ext/version.h +4 -0
  20. data/lib/ruby-prof.rb +4 -0
  21. data/lib/ruby-prof/call_info.rb +47 -0
  22. data/lib/ruby-prof/call_tree_printer.rb +9 -1
  23. data/lib/ruby-prof/graph_html_printer.rb +6 -5
  24. data/lib/ruby-prof/graph_printer.rb +3 -2
  25. data/lib/ruby-prof/method_info.rb +85 -0
  26. data/lib/ruby-prof/task.rb +1 -2
  27. data/lib/ruby-prof/test.rb +148 -0
  28. data/rails/environment/profile.rb +24 -0
  29. data/rails/example/example_test.rb +9 -0
  30. data/rails/profile_test_helper.rb +21 -0
  31. data/test/basic_test.rb +173 -80
  32. data/test/duplicate_names_test.rb +2 -3
  33. data/test/exceptions_test.rb +15 -0
  34. data/test/exclude_threads_test.rb +54 -0
  35. data/test/line_number_test.rb +18 -14
  36. data/test/measurement_test.rb +121 -0
  37. data/test/module_test.rb +5 -8
  38. data/test/no_method_class_test.rb +4 -5
  39. data/test/prime.rb +3 -5
  40. data/test/prime_test.rb +1 -12
  41. data/test/printers_test.rb +10 -13
  42. data/test/profile_unit_test.rb +10 -12
  43. data/test/recursive_test.rb +202 -92
  44. data/test/singleton_test.rb +1 -2
  45. data/test/stack_test.rb +138 -0
  46. data/test/start_stop_test.rb +95 -0
  47. data/test/test_suite.rb +7 -3
  48. data/test/thread_test.rb +111 -87
  49. data/test/unique_call_path_test.rb +206 -0
  50. metadata +40 -42
  51. data/ext/extconf.rb.rej +0 -13
  52. data/lib/ruby-prof/call_tree_printer.rb.rej +0 -27
  53. data/lib/ruby-prof/profile_test_case.rb +0 -80
  54. data/rails_plugin/ruby-prof/init.rb +0 -8
  55. data/rails_plugin/ruby-prof/lib/profiling.rb +0 -57
  56. data/test/measure_mode_test.rb +0 -79
  57. data/test/prime1.rb +0 -17
  58. data/test/prime2.rb +0 -26
  59. data/test/prime3.rb +0 -17
  60. data/test/start_test.rb +0 -24
  61. data/test/test_helper.rb +0 -55
  62. data/test/timing_test.rb +0 -133
@@ -1,24 +1,22 @@
1
1
  #!/usr/bin/env ruby
2
-
3
2
  require 'test/unit'
4
3
  require 'ruby-prof'
5
- require 'test_helper'
6
- require 'ruby-prof/profile_test_case'
7
4
 
8
5
  # Need to use wall time for this test due to the sleep calls
9
6
  RubyProf::measure_mode = RubyProf::WALL_TIME
10
7
 
11
8
  # -- Tests ----
12
9
  class ProfileTest < Test::Unit::TestCase
13
- def test_profile
14
- sleep(2)
15
- end
16
-
10
+ include RubyProf::Test
11
+
17
12
  def teardown
18
- profile_dir = output_directory
19
- assert(File.exists?(profile_dir))
13
+ profile_dir = output_dir
20
14
 
21
- file_path = File.join(profile_dir, 'test_profile_profile_test.html')
22
- assert(File.exists?(file_path))
15
+ #file_path = File.join(profile_dir, 'test_profile_profile_test.html')
16
+ #assert(File.exists?(file_path))
17
+ end
18
+
19
+ def test_profile
20
+ sleep(1)
23
21
  end
24
- end
22
+ end
@@ -1,11 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
-
3
2
  require 'test/unit'
4
3
  require 'ruby-prof'
5
- require 'test_helper'
6
-
7
- # Need to use wall time for this test due to the sleep calls
8
- RubyProf::measure_mode = RubyProf::WALL_TIME
9
4
 
10
5
  def simple(n)
11
6
  sleep(1)
@@ -25,120 +20,235 @@ def sub_cycle(n)
25
20
  cycle(n)
26
21
  end
27
22
 
28
- def factorial(n)
29
- if n < 2 then
30
- n
31
- else
32
- n * factorial(n-1)
33
- end
34
- end
35
-
36
23
 
37
24
  # -- Tests ----
38
25
  class RecursiveTest < Test::Unit::TestCase
39
- def test_recursive
26
+ def setup
27
+ # Need to use wall time for this test due to the sleep calls
28
+ RubyProf::measure_mode = RubyProf::WALL_TIME
29
+ end
30
+
31
+ def test_simple
40
32
  result = RubyProf.profile do
41
33
  simple(2)
42
34
  end
43
-
44
- result.threads.values.each do |methods|
45
- methods.each do |method|
46
- check_parent_times(method)
47
- check_parent_calls(method)
48
- check_child_times(method)
49
- end
50
- end
51
-
52
-
35
+
53
36
  methods = result.threads.values.first.sort.reverse
54
- assert_equal(6, methods.length)
37
+ assert_equal(6, methods.length)
55
38
 
56
39
  method = methods[0]
57
- assert_equal('RecursiveTest#test_recursive', method.full_name)
58
- assert_in_delta(2, method.total_time, 0.02)
59
- assert_in_delta(0, method.self_time, 0.02)
60
- assert_in_delta(0, method.wait_time, 0.02)
61
- assert_in_delta(2, method.children_time, 0.02)
62
- assert_equal(0, method.called)
63
- assert_equal(0, method.parents.length)
64
- assert_equal(1, method.children.length)
40
+ assert_equal('RecursiveTest#test_simple', method.full_name)
41
+ assert_equal(1, method.called)
42
+ assert_in_delta(2, method.total_time, 0.01)
43
+ assert_in_delta(0, method.self_time, 0.01)
44
+ assert_in_delta(0, method.wait_time, 0.01)
45
+ assert_in_delta(2, method.children_time, 0.01)
46
+
47
+ assert_equal(1, method.call_infos.length)
48
+ call_info = method.call_infos[0]
49
+ assert_equal('RecursiveTest#test_simple', call_info.call_sequence)
50
+ assert_equal(1, call_info.children.length)
65
51
 
66
52
  method = methods[1]
67
53
  assert_equal('Object#simple', method.full_name)
68
- assert_in_delta(2, method.total_time, 0.02)
69
- assert_in_delta(0, method.self_time, 0.02)
70
- assert_in_delta(0, method.wait_time, 0.02)
71
- assert_in_delta(2, method.children_time, 0.02)
72
54
  assert_equal(1, method.called)
73
- assert_equal(1, method.parents.length)
74
- assert_equal(4, method.children.length)
75
-
55
+ assert_in_delta(2, method.total_time, 0.01)
56
+ assert_in_delta(0, method.self_time, 0.01)
57
+ assert_in_delta(0, method.wait_time, 0.01)
58
+ assert_in_delta(2, method.children_time, 0.01)
59
+
60
+ assert_equal(1, method.call_infos.length)
61
+ call_info = method.call_infos[0]
62
+ assert_equal('RecursiveTest#test_simple->Object#simple', call_info.call_sequence)
63
+ assert_equal(4, call_info.children.length)
64
+
76
65
  method = methods[2]
77
66
  assert_equal('Kernel#sleep', method.full_name)
78
- assert_in_delta(2, method.total_time, 0.02)
79
- assert_in_delta(2, method.self_time, 0.02)
80
- assert_in_delta(0, method.wait_time, 0.02)
81
- assert_in_delta(0, method.children_time, 0.02)
82
67
  assert_equal(2, method.called)
83
- assert_equal(2, method.parents.length)
84
- assert_equal(0, method.children.length)
85
-
68
+ assert_in_delta(2, method.total_time, 0.01)
69
+ assert_in_delta(2, method.self_time, 0.01)
70
+ assert_in_delta(0, method.wait_time, 0.01)
71
+ assert_in_delta(0, method.children_time, 0.01)
72
+
73
+ assert_equal(2, method.call_infos.length)
74
+ call_info = method.call_infos[0]
75
+ assert_equal('RecursiveTest#test_simple->Object#simple->Kernel#sleep', call_info.call_sequence)
76
+ assert_equal(0, call_info.children.length)
77
+
78
+ call_info = method.call_infos[1]
79
+ assert_equal('RecursiveTest#test_simple->Object#simple->Object#simple-1->Kernel#sleep', call_info.call_sequence)
80
+ assert_equal(0, call_info.children.length)
81
+
86
82
  method = methods[3]
87
83
  assert_equal('Object#simple-1', method.full_name)
88
- assert_in_delta(1, method.total_time, 0.02)
89
- assert_in_delta(0, method.self_time, 0.02)
90
- assert_in_delta(0, method.wait_time, 0.02)
91
- assert_in_delta(1, method.children_time, 0.02)
92
84
  assert_equal(1, method.called)
93
- assert_equal(1, method.parents.length)
94
- assert_equal(3, method.children.length)
95
-
85
+ assert_in_delta(1, method.total_time, 0.01)
86
+ assert_in_delta(0, method.self_time, 0.01)
87
+ assert_in_delta(0, method.wait_time, 0.01)
88
+ assert_in_delta(1, method.children_time, 0.01)
89
+
90
+ assert_equal(1, method.call_infos.length)
91
+ call_info = method.call_infos[0]
92
+ assert_equal('RecursiveTest#test_simple->Object#simple->Object#simple-1', call_info.call_sequence)
93
+ assert_equal(3, call_info.children.length)
94
+
96
95
  method = methods[4]
97
- assert_equal('Fixnum#==', method.full_name)
98
- assert_in_delta(0, method.total_time, 0.02)
99
- assert_in_delta(0, method.self_time, 0.02)
100
- assert_in_delta(0, method.wait_time, 0.02)
101
- assert_in_delta(0, method.children_time, 0.02)
96
+ assert_equal('Fixnum#-', method.full_name)
102
97
  assert_equal(2, method.called)
103
- assert_equal(2, method.parents.length)
104
- assert_equal(0, method.children.length)
105
-
98
+ assert_in_delta(0, method.total_time, 0.01)
99
+ assert_in_delta(0, method.self_time, 0.01)
100
+ assert_in_delta(0, method.wait_time, 0.01)
101
+ assert_in_delta(0, method.children_time, 0.01)
102
+
103
+ assert_equal(2, method.call_infos.length)
104
+ call_info = method.call_infos[0]
105
+ assert_equal('RecursiveTest#test_simple->Object#simple->Fixnum#-', call_info.call_sequence)
106
+ assert_equal(0, call_info.children.length)
107
+
108
+ call_info = method.call_infos[1]
109
+ assert_equal('RecursiveTest#test_simple->Object#simple->Object#simple-1->Fixnum#-', call_info.call_sequence)
110
+ assert_equal(0, call_info.children.length)
111
+
106
112
  method = methods[5]
107
- assert_equal('Fixnum#-', method.full_name)
108
- assert_in_delta(0, method.total_time, 0.02)
109
- assert_in_delta(0, method.self_time, 0.02)
110
- assert_in_delta(0, method.wait_time, 0.02)
111
- assert_in_delta(0, method.children_time, 0.02)
113
+ assert_equal('Fixnum#==', method.full_name)
112
114
  assert_equal(2, method.called)
113
- assert_equal(2, method.parents.length)
114
- assert_equal(0, method.children.length)
115
+ assert_in_delta(0, method.total_time, 0.01)
116
+ assert_in_delta(0, method.self_time, 0.01)
117
+ assert_in_delta(0, method.wait_time, 0.01)
118
+ assert_in_delta(0, method.children_time, 0.01)
119
+
120
+ assert_equal(2, method.call_infos.length)
121
+ call_info = method.call_infos[0]
122
+ assert_equal('RecursiveTest#test_simple->Object#simple->Fixnum#==', call_info.call_sequence)
123
+ assert_equal(0, call_info.children.length)
124
+
125
+ call_info = method.call_infos[1]
126
+ assert_equal('RecursiveTest#test_simple->Object#simple->Object#simple-1->Fixnum#==', call_info.call_sequence)
127
+ assert_equal(0, call_info.children.length)
115
128
  end
116
129
 
117
130
  def test_cycle
118
131
  result = RubyProf.profile do
119
132
  cycle(2)
120
133
  end
121
- result.threads.values.each do |methods|
122
- methods.each do |method|
123
- check_parent_times(method)
124
- check_parent_calls(method)
125
- check_child_times(method)
126
- end
127
- end
134
+
135
+ methods = result.threads.values.first.sort.reverse
136
+ assert_equal(8, methods.length)
137
+
138
+ method = methods[0]
139
+ assert_equal('RecursiveTest#test_cycle', method.full_name)
140
+ assert_equal(1, method.called)
141
+ assert_in_delta(2, method.total_time, 0.01)
142
+ assert_in_delta(0, method.self_time, 0.01)
143
+ assert_in_delta(0, method.wait_time, 0.01)
144
+ assert_in_delta(2, method.children_time, 0.01)
145
+
146
+ assert_equal(1, method.call_infos.length)
147
+ call_info = method.call_infos[0]
148
+ assert_equal('RecursiveTest#test_cycle', call_info.call_sequence)
149
+ assert_equal(1, call_info.children.length)
150
+
151
+ method = methods[1]
152
+ assert_equal('Object#cycle', method.full_name)
153
+ assert_equal(1, method.called)
154
+ assert_in_delta(2, method.total_time, 0.01)
155
+ assert_in_delta(0, method.self_time, 0.01)
156
+ assert_in_delta(0, method.wait_time, 0.01)
157
+ assert_in_delta(2, method.children_time, 0.01)
158
+
159
+ assert_equal(1, method.call_infos.length)
160
+ call_info = method.call_infos[0]
161
+ assert_equal('RecursiveTest#test_cycle->Object#cycle', call_info.call_sequence)
162
+ assert_equal(1, call_info.children.length)
163
+
164
+ method = methods[2]
165
+ assert_equal('Object#sub_cycle', method.full_name)
166
+ assert_equal(1, method.called)
167
+ assert_in_delta(2, method.total_time, 0.01)
168
+ assert_in_delta(0, method.self_time, 0.01)
169
+ assert_in_delta(0, method.wait_time, 0.01)
170
+ assert_in_delta(2, method.children_time, 0.01)
171
+
172
+ assert_equal(1, method.call_infos.length)
173
+ call_info = method.call_infos[0]
174
+ assert_equal('RecursiveTest#test_cycle->Object#cycle->Object#sub_cycle', call_info.call_sequence)
175
+ assert_equal(4, call_info.children.length)
176
+
177
+ method = methods[3]
178
+ assert_equal('Kernel#sleep', method.full_name)
179
+ assert_equal(2, method.called)
180
+ assert_in_delta(2, method.total_time, 0.01)
181
+ assert_in_delta(2, method.self_time, 0.01)
182
+ assert_in_delta(0, method.wait_time, 0.01)
183
+ assert_in_delta(0, method.children_time, 0.01)
184
+
185
+ assert_equal(2, method.call_infos.length)
186
+ call_info = method.call_infos[0]
187
+ assert_equal('RecursiveTest#test_cycle->Object#cycle->Object#sub_cycle->Kernel#sleep', call_info.call_sequence)
188
+ assert_equal(0, call_info.children.length)
189
+
190
+ call_info = method.call_infos[1]
191
+ assert_equal('RecursiveTest#test_cycle->Object#cycle->Object#sub_cycle->Object#cycle-1->Object#sub_cycle-1->Kernel#sleep', call_info.call_sequence)
192
+ assert_equal(0, call_info.children.length)
193
+
194
+ method = methods[4]
195
+ assert_equal('Object#cycle-1', method.full_name)
196
+ assert_equal(1, method.called)
197
+ assert_in_delta(1, method.total_time, 0.01)
198
+ assert_in_delta(0, method.self_time, 0.01)
199
+ assert_in_delta(0, method.wait_time, 0.01)
200
+ assert_in_delta(1, method.children_time, 0.01)
201
+
202
+ assert_equal(1, method.call_infos.length)
203
+ call_info = method.call_infos[0]
204
+ assert_equal('RecursiveTest#test_cycle->Object#cycle->Object#sub_cycle->Object#cycle-1', call_info.call_sequence)
205
+ assert_equal(1, call_info.children.length)
206
+
207
+ method = methods[5]
208
+ assert_equal('Object#sub_cycle-1', method.full_name)
209
+ assert_equal(1, method.called)
210
+ assert_in_delta(1, method.total_time, 0.01)
211
+ assert_in_delta(0, method.self_time, 0.01)
212
+ assert_in_delta(0, method.wait_time, 0.01)
213
+ assert_in_delta(1, method.children_time, 0.01)
214
+
215
+ assert_equal(1, method.call_infos.length)
216
+ call_info = method.call_infos[0]
217
+ assert_equal('RecursiveTest#test_cycle->Object#cycle->Object#sub_cycle->Object#cycle-1->Object#sub_cycle-1', call_info.call_sequence)
218
+ assert_equal(3, call_info.children.length)
219
+
220
+ method = methods[6]
221
+ assert_equal('Fixnum#-', method.full_name)
222
+ assert_equal(2, method.called)
223
+ assert_in_delta(0, method.total_time, 0.01)
224
+ assert_in_delta(0, method.self_time, 0.01)
225
+ assert_in_delta(0, method.wait_time, 0.01)
226
+ assert_in_delta(0, method.children_time, 0.01)
227
+
228
+ assert_equal(2, method.call_infos.length)
229
+ call_info = method.call_infos[0]
230
+ assert_equal('RecursiveTest#test_cycle->Object#cycle->Object#sub_cycle->Fixnum#-', call_info.call_sequence)
231
+ assert_equal(0, call_info.children.length)
232
+
233
+ call_info = method.call_infos[1]
234
+ assert_equal('RecursiveTest#test_cycle->Object#cycle->Object#sub_cycle->Object#cycle-1->Object#sub_cycle-1->Fixnum#-', call_info.call_sequence)
235
+ assert_equal(0, call_info.children.length)
236
+
237
+ method = methods[7]
238
+ assert_equal('Fixnum#==', method.full_name)
239
+ assert_equal(2, method.called)
240
+ assert_in_delta(0, method.total_time, 0.01)
241
+ assert_in_delta(0, method.self_time, 0.01)
242
+ assert_in_delta(0, method.wait_time, 0.01)
243
+ assert_in_delta(0, method.children_time, 0.01)
244
+
245
+ assert_equal(2, method.call_infos.length)
246
+ call_info = method.call_infos[0]
247
+ assert_equal('RecursiveTest#test_cycle->Object#cycle->Object#sub_cycle->Fixnum#==', call_info.call_sequence)
248
+ assert_equal(0, call_info.children.length)
249
+
250
+ call_info = method.call_infos[1]
251
+ assert_equal('RecursiveTest#test_cycle->Object#cycle->Object#sub_cycle->Object#cycle-1->Object#sub_cycle-1->Fixnum#==', call_info.call_sequence)
252
+ assert_equal(0, call_info.children.length)
128
253
  end
129
-
130
- def test_factorial
131
- result = RubyProf.profile do
132
- # Around 700 on windows causes "stack level too deep" error
133
- factorial(650)
134
- end
135
-
136
- result.threads.values.each do |methods|
137
- methods.each do |method|
138
- check_parent_times(method)
139
- check_parent_calls(method)
140
- check_child_times(method)
141
- end
142
- end
143
- end
144
- end
254
+ end
@@ -34,5 +34,4 @@ class SingletonTest < Test::Unit::TestCase
34
34
  printer = RubyProf::FlatPrinter.new(result)
35
35
  printer.print(STDOUT)
36
36
  end
37
- end
38
-
37
+ end
@@ -0,0 +1,138 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'test/unit'
4
+ require 'ruby-prof'
5
+
6
+ # Test data
7
+ # A
8
+ # / \
9
+ # B C
10
+ # \
11
+ # B
12
+
13
+ class C1
14
+ def a
15
+ sleep 1
16
+ b
17
+ c
18
+ end
19
+
20
+ def b
21
+ sleep 2
22
+ end
23
+
24
+ def c
25
+ sleep 3
26
+ b
27
+ end
28
+ end
29
+
30
+ class StackTest < Test::Unit::TestCase
31
+ def setup
32
+ # Need to use wall time for this test due to the sleep calls
33
+ RubyProf::measure_mode = RubyProf::WALL_TIME
34
+ end
35
+
36
+ def test_call_sequence
37
+ c = C1.new
38
+ result = RubyProf.profile do
39
+ c.a
40
+ end
41
+
42
+ # Length should be 5:
43
+ # StackTest#test_call_sequence
44
+ # C1#a
45
+ # Kernel#sleep
46
+ # C1#c
47
+ # C1#b
48
+
49
+ methods = result.threads.values.first.sort.reverse
50
+ assert_equal(5, methods.length)
51
+
52
+ # Check StackTest#test_call_sequence
53
+ method = methods[0]
54
+ assert_equal('StackTest#test_call_sequence', method.full_name)
55
+ assert_equal(1, method.called)
56
+ assert_in_delta(8, method.total_time, 0.01)
57
+ assert_in_delta(0, method.wait_time, 0.01)
58
+ assert_in_delta(0, method.self_time, 0.01)
59
+ assert_in_delta(8, method.children_time, 0.01)
60
+ assert_equal(1, method.call_infos.length)
61
+
62
+ call_info = method.call_infos[0]
63
+ assert_equal('StackTest#test_call_sequence', call_info.call_sequence)
64
+ assert_equal(1, call_info.children.length)
65
+
66
+ # Check C1#a
67
+ method = methods[1]
68
+ assert_equal('C1#a', method.full_name)
69
+ assert_equal(1, method.called)
70
+ assert_in_delta(8, method.total_time, 0.01)
71
+ assert_in_delta(0, method.wait_time, 0.01)
72
+ assert_in_delta(0, method.self_time, 0.01)
73
+ assert_in_delta(8, method.children_time, 0.01)
74
+ assert_equal(1, method.call_infos.length)
75
+
76
+ call_info = method.call_infos[0]
77
+ assert_equal('StackTest#test_call_sequence->C1#a', call_info.call_sequence)
78
+ assert_equal(3, call_info.children.length)
79
+
80
+ # Check Kernel#sleep
81
+ method = methods[2]
82
+ assert_equal('Kernel#sleep', method.full_name)
83
+ assert_equal(4, method.called)
84
+ assert_in_delta(8, method.total_time, 0.01)
85
+ assert_in_delta(0, method.wait_time, 0.01)
86
+ assert_in_delta(8, method.self_time, 0.01)
87
+ assert_in_delta(0, method.children_time, 0.01)
88
+ assert_equal(4, method.call_infos.length)
89
+
90
+ call_info = method.call_infos[0]
91
+ assert_equal('StackTest#test_call_sequence->C1#a->Kernel#sleep', call_info.call_sequence)
92
+ assert_equal(0, call_info.children.length)
93
+
94
+ call_info = method.call_infos[1]
95
+ assert_equal('StackTest#test_call_sequence->C1#a->C1#b->Kernel#sleep', call_info.call_sequence)
96
+ assert_equal(0, call_info.children.length)
97
+
98
+ call_info = method.call_infos[2]
99
+ assert_equal('StackTest#test_call_sequence->C1#a->C1#c->Kernel#sleep', call_info.call_sequence)
100
+ assert_equal(0, call_info.children.length)
101
+
102
+ call_info = method.call_infos[3]
103
+ assert_equal('StackTest#test_call_sequence->C1#a->C1#c->C1#b->Kernel#sleep', call_info.call_sequence)
104
+ assert_equal(0, call_info.children.length)
105
+
106
+ # Check C1#c
107
+ method = methods[3]
108
+ assert_equal('C1#c', method.full_name)
109
+ assert_equal(1, method.called)
110
+ assert_in_delta(5, method.total_time, 0.01)
111
+ assert_in_delta(0, method.wait_time, 0.01)
112
+ assert_in_delta(0, method.self_time, 0.01)
113
+ assert_in_delta(5, method.children_time, 0.01)
114
+ assert_equal(1, method.call_infos.length)
115
+
116
+ call_info = method.call_infos[0]
117
+ assert_equal('StackTest#test_call_sequence->C1#a->C1#c', call_info.call_sequence)
118
+ assert_equal(2, call_info.children.length)
119
+
120
+ # Check C1#b
121
+ method = methods[4]
122
+ assert_equal('C1#b', method.full_name)
123
+ assert_equal(2, method.called)
124
+ assert_in_delta(4, method.total_time, 0.01)
125
+ assert_in_delta(0, method.wait_time, 0.01)
126
+ assert_in_delta(0, method.self_time, 0.01)
127
+ assert_in_delta(4, method.children_time, 0.01)
128
+ assert_equal(2, method.call_infos.length)
129
+
130
+ call_info = method.call_infos[0]
131
+ assert_equal('StackTest#test_call_sequence->C1#a->C1#b', call_info.call_sequence)
132
+ assert_equal(1, call_info.children.length)
133
+
134
+ call_info = method.call_infos[1]
135
+ assert_equal('StackTest#test_call_sequence->C1#a->C1#c->C1#b', call_info.call_sequence)
136
+ assert_equal(1, call_info.children.length)
137
+ end
138
+ end