acunote-ruby-prof 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. data/CHANGES +240 -0
  2. data/LICENSE +23 -0
  3. data/README.rdoc +439 -0
  4. data/Rakefile +148 -0
  5. data/bin/ruby-prof +236 -0
  6. data/examples/empty.png +0 -0
  7. data/examples/flat.txt +55 -0
  8. data/examples/graph.dot +106 -0
  9. data/examples/graph.html +823 -0
  10. data/examples/graph.png +0 -0
  11. data/examples/graph.txt +170 -0
  12. data/examples/minus.png +0 -0
  13. data/examples/multi.flat.txt +23 -0
  14. data/examples/multi.graph.html +906 -0
  15. data/examples/multi.grind.dat +194 -0
  16. data/examples/multi.stack.html +573 -0
  17. data/examples/plus.png +0 -0
  18. data/examples/stack.html +573 -0
  19. data/ext/ruby_prof/extconf.rb +43 -0
  20. data/ext/ruby_prof/measure_allocations.h +58 -0
  21. data/ext/ruby_prof/measure_cpu_time.h +152 -0
  22. data/ext/ruby_prof/measure_gc_runs.h +76 -0
  23. data/ext/ruby_prof/measure_gc_time.h +57 -0
  24. data/ext/ruby_prof/measure_memory.h +101 -0
  25. data/ext/ruby_prof/measure_process_time.h +52 -0
  26. data/ext/ruby_prof/measure_wall_time.h +53 -0
  27. data/ext/ruby_prof/mingw/Rakefile +23 -0
  28. data/ext/ruby_prof/mingw/build.rake +38 -0
  29. data/ext/ruby_prof/ruby_prof.c +1834 -0
  30. data/ext/ruby_prof/ruby_prof.h +190 -0
  31. data/ext/ruby_prof/version.h +4 -0
  32. data/lib/ruby-prof.rb +62 -0
  33. data/lib/ruby-prof/abstract_printer.rb +41 -0
  34. data/lib/ruby-prof/aggregate_call_info.rb +68 -0
  35. data/lib/ruby-prof/call_info.rb +112 -0
  36. data/lib/ruby-prof/call_stack_printer.rb +751 -0
  37. data/lib/ruby-prof/call_tree_printer.rb +133 -0
  38. data/lib/ruby-prof/dot_printer.rb +153 -0
  39. data/lib/ruby-prof/empty.png +0 -0
  40. data/lib/ruby-prof/flat_printer.rb +78 -0
  41. data/lib/ruby-prof/flat_printer_with_line_numbers.rb +72 -0
  42. data/lib/ruby-prof/graph_html_printer.rb +278 -0
  43. data/lib/ruby-prof/graph_printer.rb +245 -0
  44. data/lib/ruby-prof/method_info.rb +131 -0
  45. data/lib/ruby-prof/minus.png +0 -0
  46. data/lib/ruby-prof/multi_printer.rb +54 -0
  47. data/lib/ruby-prof/plus.png +0 -0
  48. data/lib/ruby-prof/rack.rb +30 -0
  49. data/lib/ruby-prof/result.rb +70 -0
  50. data/lib/ruby-prof/symbol_to_proc.rb +8 -0
  51. data/lib/ruby-prof/task.rb +146 -0
  52. data/lib/ruby-prof/test.rb +148 -0
  53. data/lib/unprof.rb +8 -0
  54. data/rails/environment/profile.rb +24 -0
  55. data/rails/example/example_test.rb +9 -0
  56. data/rails/profile_test_helper.rb +21 -0
  57. data/test/aggregate_test.rb +136 -0
  58. data/test/basic_test.rb +290 -0
  59. data/test/current_failures_windows +8 -0
  60. data/test/do_nothing.rb +0 -0
  61. data/test/duplicate_names_test.rb +32 -0
  62. data/test/enumerable_test.rb +16 -0
  63. data/test/exceptions_test.rb +15 -0
  64. data/test/exclude_threads_test.rb +54 -0
  65. data/test/exec_test.rb +14 -0
  66. data/test/line_number_test.rb +73 -0
  67. data/test/measurement_test.rb +122 -0
  68. data/test/method_elimination_test.rb +74 -0
  69. data/test/module_test.rb +44 -0
  70. data/test/multi_printer_test.rb +81 -0
  71. data/test/no_method_class_test.rb +13 -0
  72. data/test/prime.rb +55 -0
  73. data/test/prime_test.rb +13 -0
  74. data/test/printers_test.rb +164 -0
  75. data/test/recursive_test.rb +236 -0
  76. data/test/ruby-prof-bin +20 -0
  77. data/test/singleton_test.rb +38 -0
  78. data/test/stack_printer_test.rb +74 -0
  79. data/test/stack_test.rb +138 -0
  80. data/test/start_stop_test.rb +112 -0
  81. data/test/test_suite.rb +32 -0
  82. data/test/thread_test.rb +173 -0
  83. data/test/unique_call_path_test.rb +225 -0
  84. metadata +185 -0
@@ -0,0 +1,236 @@
1
+ #!/usr/bin/env ruby
2
+ require 'test/unit'
3
+ require 'ruby-prof'
4
+
5
+ def simple(n)
6
+ sleep(1)
7
+ n -= 1
8
+ return if n == 0
9
+ simple(n)
10
+ end
11
+
12
+ def cycle(n)
13
+ sub_cycle(n)
14
+ end
15
+
16
+ def sub_cycle(n)
17
+ sleep(1)
18
+ n -= 1
19
+ return if n == 0
20
+ cycle(n)
21
+ end
22
+
23
+
24
+ # -- Tests ----
25
+ class RecursiveTest < Test::Unit::TestCase
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
32
+ result = RubyProf.profile do
33
+ simple(2)
34
+ end
35
+
36
+ methods = result.threads.values.first.sort.reverse
37
+
38
+ if RUBY_VERSION < '1.9'
39
+ assert_equal(5, methods.length) # includes Fixnum+, Fixnum==...
40
+ else
41
+ assert_equal(3, methods.length) # which don't show up in 1.9
42
+ end
43
+
44
+ method = methods[0]
45
+ assert_equal('RecursiveTest#test_simple', method.full_name)
46
+ assert_equal(1, method.called)
47
+ assert_in_delta(2, method.total_time, 0.05)
48
+ assert_in_delta(0, method.self_time, 0.01)
49
+ assert_in_delta(0, method.wait_time, 0.01)
50
+ assert_in_delta(2, method.children_time, 0.05)
51
+
52
+ assert_equal(1, method.call_infos.length)
53
+ call_info = method.call_infos[0]
54
+ assert_equal('RecursiveTest#test_simple', call_info.call_sequence)
55
+ assert_equal(1, call_info.children.length)
56
+
57
+ method = methods[1]
58
+ assert_equal('Object#simple', method.full_name)
59
+ assert_equal(2, 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)
64
+
65
+ assert_equal(2, method.call_infos.length)
66
+ call_info = method.call_infos[0]
67
+ assert_equal('RecursiveTest#test_simple->Object#simple', call_info.call_sequence)
68
+ if RUBY_VERSION < '1.9'
69
+ assert_equal(4, call_info.children.length)
70
+ else
71
+ assert_equal(2, call_info.children.length)
72
+ end
73
+
74
+ method = methods[2]
75
+ assert_equal('Kernel#sleep', method.full_name)
76
+ assert_equal(2, method.called)
77
+ assert_in_delta(2, method.total_time, 0.05)
78
+ assert_in_delta(2, method.self_time, 0.05)
79
+ assert_in_delta(0, method.wait_time, 0.05)
80
+ assert_in_delta(0, method.children_time, 0.05)
81
+
82
+ assert_equal(2, method.call_infos.length)
83
+ call_info = method.call_infos[0]
84
+ assert_equal('RecursiveTest#test_simple->Object#simple->Kernel#sleep', call_info.call_sequence)
85
+ assert_equal(0, call_info.children.length)
86
+
87
+ call_info = method.call_infos[1]
88
+ assert_equal('RecursiveTest#test_simple->Object#simple->Object#simple->Kernel#sleep', call_info.call_sequence)
89
+ assert_equal(0, call_info.children.length)
90
+
91
+ if RUBY_VERSION < '1.9'
92
+ method = methods[3]
93
+ assert_equal('Fixnum#-', method.full_name)
94
+ assert_equal(2, method.called)
95
+ assert_in_delta(0, method.total_time, 0.01)
96
+ assert_in_delta(0, method.self_time, 0.01)
97
+ assert_in_delta(0, method.wait_time, 0.01)
98
+ assert_in_delta(0, method.children_time, 0.01)
99
+
100
+ assert_equal(2, method.call_infos.length)
101
+ call_info = method.call_infos[0]
102
+ assert_equal('RecursiveTest#test_simple->Object#simple->Fixnum#-', call_info.call_sequence)
103
+ assert_equal(0, call_info.children.length)
104
+
105
+ call_info = method.call_infos[1]
106
+ assert_equal('RecursiveTest#test_simple->Object#simple->Object#simple->Fixnum#-', call_info.call_sequence)
107
+ assert_equal(0, call_info.children.length)
108
+
109
+ method = methods[4]
110
+ assert_equal('Fixnum#==', method.full_name)
111
+ assert_equal(2, method.called)
112
+ assert_in_delta(0, method.total_time, 0.01)
113
+ assert_in_delta(0, method.self_time, 0.01)
114
+ assert_in_delta(0, method.wait_time, 0.01)
115
+ assert_in_delta(0, method.children_time, 0.01)
116
+
117
+ assert_equal(2, method.call_infos.length)
118
+ call_info = method.call_infos[0]
119
+ assert_equal('RecursiveTest#test_simple->Object#simple->Fixnum#==', call_info.call_sequence)
120
+ assert_equal(0, call_info.children.length)
121
+
122
+ call_info = method.call_infos[1]
123
+ assert_equal('RecursiveTest#test_simple->Object#simple->Object#simple->Fixnum#==', call_info.call_sequence)
124
+ assert_equal(0, call_info.children.length)
125
+ end
126
+ end
127
+
128
+ def test_cycle
129
+ result = RubyProf.profile do
130
+ cycle(2)
131
+ end
132
+
133
+ methods = result.threads.values.first.sort.reverse
134
+ if RUBY_VERSION < '1.9'
135
+ assert_equal(6, methods.length) # includes Fixnum+ and Fixnum==, which aren't included in 1.9
136
+ else
137
+ assert_equal(4, methods.length) # which don't show up in 1.9
138
+ end
139
+ method = methods[0]
140
+ assert_equal('RecursiveTest#test_cycle', method.full_name)
141
+ assert_equal(1, method.called)
142
+ assert_in_delta(2, method.total_time, 0.05)
143
+ assert_in_delta(0, method.self_time, 0.01)
144
+ assert_in_delta(0, method.wait_time, 0.01)
145
+ assert_in_delta(2, method.children_time, 0.05)
146
+
147
+ assert_equal(1, method.call_infos.length)
148
+ call_info = method.call_infos[0]
149
+ assert_equal('RecursiveTest#test_cycle', call_info.call_sequence)
150
+ assert_equal(1, call_info.children.length)
151
+
152
+ method = methods[1]
153
+ assert_equal('Object#cycle', method.full_name)
154
+ assert_equal(2, method.called)
155
+ assert_in_delta(2, method.total_time, 0.05)
156
+ assert_in_delta(0, method.self_time, 0.01)
157
+ assert_in_delta(0, method.wait_time, 0.01)
158
+ assert_in_delta(2, method.children_time, 0.05)
159
+
160
+ assert_equal(2, method.call_infos.length)
161
+ call_info = method.call_infos[0]
162
+ assert_equal('RecursiveTest#test_cycle->Object#cycle', call_info.call_sequence)
163
+ assert_equal(1, call_info.children.length)
164
+
165
+ method = methods[2]
166
+ assert_equal('Object#sub_cycle', method.full_name)
167
+ assert_equal(2, method.called)
168
+ assert_in_delta(2, method.total_time, 0.05)
169
+ assert_in_delta(0, method.self_time, 0.05)
170
+ assert_in_delta(0, method.wait_time, 0.05)
171
+ assert_in_delta(2, method.children_time, 0.05)
172
+
173
+ assert_equal(2, method.call_infos.length)
174
+ call_info = method.call_infos[0]
175
+ assert_equal('RecursiveTest#test_cycle->Object#cycle->Object#sub_cycle', call_info.call_sequence)
176
+ if RUBY_VERSION < '1.9'
177
+ assert_equal(4, call_info.children.length)
178
+ else
179
+ assert_equal(2, call_info.children.length)
180
+ end
181
+
182
+ method = methods[3]
183
+ assert_equal('Kernel#sleep', method.full_name)
184
+ assert_equal(2, method.called)
185
+ assert_in_delta(2, method.total_time, 0.05)
186
+ assert_in_delta(2, method.self_time, 0.05)
187
+ assert_in_delta(0, method.wait_time, 0.01)
188
+ assert_in_delta(0, method.children_time, 0.01)
189
+
190
+ assert_equal(2, method.call_infos.length)
191
+ call_info = method.call_infos[0]
192
+ assert_equal('RecursiveTest#test_cycle->Object#cycle->Object#sub_cycle->Kernel#sleep', call_info.call_sequence)
193
+ assert_equal(0, call_info.children.length)
194
+
195
+ call_info = method.call_infos[1]
196
+ assert_equal('RecursiveTest#test_cycle->Object#cycle->Object#sub_cycle->Object#cycle->Object#sub_cycle->Kernel#sleep', call_info.call_sequence)
197
+ assert_equal(0, call_info.children.length)
198
+
199
+ if RUBY_VERSION < '1.9'
200
+ method = methods[4]
201
+ assert_equal('Fixnum#-', method.full_name)
202
+ assert_equal(2, method.called)
203
+ assert_in_delta(0, method.total_time, 0.01)
204
+ assert_in_delta(0, method.self_time, 0.01)
205
+ assert_in_delta(0, method.wait_time, 0.01)
206
+ assert_in_delta(0, method.children_time, 0.01)
207
+
208
+ assert_equal(2, method.call_infos.length)
209
+ call_info = method.call_infos[0]
210
+ assert_equal('RecursiveTest#test_cycle->Object#cycle->Object#sub_cycle->Fixnum#-', call_info.call_sequence)
211
+ assert_equal(0, call_info.children.length)
212
+
213
+ call_info = method.call_infos[1]
214
+ assert_equal('RecursiveTest#test_cycle->Object#cycle->Object#sub_cycle->Object#cycle->Object#sub_cycle->Fixnum#-', call_info.call_sequence)
215
+ assert_equal(0, call_info.children.length)
216
+
217
+ method = methods[5]
218
+ assert_equal('Fixnum#==', method.full_name)
219
+ assert_equal(2, method.called)
220
+ assert_in_delta(0, method.total_time, 0.01)
221
+ assert_in_delta(0, method.self_time, 0.01)
222
+ assert_in_delta(0, method.wait_time, 0.01)
223
+ assert_in_delta(0, method.children_time, 0.01)
224
+
225
+ assert_equal(2, method.call_infos.length)
226
+ call_info = method.call_infos[0]
227
+ assert_equal('RecursiveTest#test_cycle->Object#cycle->Object#sub_cycle->Fixnum#==', call_info.call_sequence)
228
+ assert_equal(0, call_info.children.length)
229
+
230
+ call_info = method.call_infos[1]
231
+ assert_equal('RecursiveTest#test_cycle->Object#cycle->Object#sub_cycle->Object#cycle->Object#sub_cycle->Fixnum#==', call_info.call_sequence)
232
+ assert_equal(0, call_info.children.length)
233
+ end
234
+
235
+ end
236
+ end
@@ -0,0 +1,20 @@
1
+ #!E:/installs/ruby191p376/bin/ruby.exe
2
+ #
3
+ # This file was generated by RubyGems.
4
+ #
5
+ # The application 'ruby-prof' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require 'rubygems'
10
+
11
+ version = ">= 0"
12
+
13
+ if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then
14
+ version = $1
15
+ ARGV.shift
16
+ end
17
+
18
+ #gem 'ruby-prof', version
19
+ $: << File.dirname(__FILE__) + '/../lib'
20
+ load File.dirname(__FILE__) + '/../bin/ruby-prof'
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'test/unit'
4
+ require 'ruby-prof'
5
+ require 'timeout'
6
+
7
+ # -- Test for bug [#5657]
8
+ # http://rubyforge.org/tracker/index.php?func=detail&aid=5657&group_id=1814&atid=7060
9
+
10
+
11
+ class A
12
+ attr_accessor :as
13
+ def initialize
14
+ @as = []
15
+ class << @as
16
+ def <<(an_a)
17
+ super
18
+ end
19
+ end
20
+ end
21
+
22
+ def <<(an_a)
23
+ @as << an_a
24
+ end
25
+ end
26
+
27
+ class SingletonTest < Test::Unit::TestCase
28
+ def test_singleton
29
+ result = RubyProf.profile do
30
+ a = A.new
31
+ a << :first_thing
32
+ assert_equal(1, a.as.size)
33
+ end
34
+ printer = RubyProf::FlatPrinter.new(result)
35
+ output = ENV['SHOW_RUBY_PROF_PRINTER_OUTPUT'] == "1" ? STDOUT : ''
36
+ printer.print(output)
37
+ end
38
+ end
@@ -0,0 +1,74 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'test/unit'
4
+ require 'ruby-prof'
5
+ require 'tmpdir'
6
+
7
+ # Test data
8
+ # A
9
+ # / \
10
+ # B C
11
+ # \
12
+ # B
13
+
14
+ class STPT
15
+ def a
16
+ 100.times{b}
17
+ 300.times{c}
18
+ c;c;c
19
+ end
20
+
21
+ def b
22
+ sleep 0
23
+ end
24
+
25
+ def c
26
+ 5.times{b}
27
+ end
28
+ end
29
+
30
+ class StackPrinterTest < 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_stack_can_be_printed
37
+ start_time = Time.now
38
+ RubyProf.start
39
+ 5.times{STPT.new.a}
40
+ result = RubyProf.stop
41
+ end_time = Time.now
42
+ expected_time = end_time - start_time
43
+
44
+ file_contents = nil
45
+ assert_nothing_raised { file_contents = print(result) }
46
+ assert file_contents =~ /Thread: (\d+) \(100\.00% ~ ([.0-9]+)\)/
47
+ actual_time = $2.to_f
48
+ difference = (expected_time-actual_time).abs
49
+ assert difference<0.001 # less than 1 ms
50
+ end
51
+
52
+ def test_method_elimination
53
+ RubyProf.start
54
+ 5.times{STPT.new.a}
55
+ result = RubyProf.stop
56
+ assert_nothing_raised {
57
+ # result.dump
58
+ result.eliminate_methods!([/Integer#times/])
59
+ # $stderr.puts "================================"
60
+ # result.dump
61
+ print(result)
62
+ }
63
+ end
64
+
65
+ private
66
+ def print(result)
67
+ test = caller.first =~ /in `(.*)'/ ? $1 : "test"
68
+ testfile_name = "#{Dir::tmpdir}/ruby_prof_#{test}.html"
69
+ printer = RubyProf::CallStackPrinter.new(result)
70
+ File.open(testfile_name, "w") {|f| printer.print(f, :threshold => 0, :min_percent => 0, :title => "ruby_prof #{test}")}
71
+ system("open '#{testfile_name}'") if RUBY_PLATFORM =~ /darwin/ && ENV['SHOW_RUBY_PROF_PRINTER_OUTPUT']=="1"
72
+ File.open(testfile_name, "r"){|f| f.read}
73
+ end
74
+ 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 StackClass
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 = StackClass.new
38
+ result = RubyProf.profile do
39
+ c.a
40
+ end
41
+
42
+ # Length should be 5:
43
+ # StackTest#test_call_sequence
44
+ # StackClass#a
45
+ # Kernel#sleep
46
+ # StackClass#c
47
+ # StackClass#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.25)
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.25)
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 StackClass#a
67
+ method = methods[1]
68
+ assert_equal('StackClass#a', method.full_name)
69
+ assert_equal(1, method.called)
70
+ assert_in_delta(8, method.total_time, 0.15)
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.05)
74
+ assert_equal(1, method.call_infos.length)
75
+
76
+ call_info = method.call_infos[0]
77
+ assert_equal('StackTest#test_call_sequence->StackClass#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.05)
85
+ assert_in_delta(0, method.wait_time, 0.01)
86
+ assert_in_delta(8, method.self_time, 0.05)
87
+ assert_in_delta(0, method.children_time, 0.05)
88
+ assert_equal(4, method.call_infos.length)
89
+
90
+ call_info = method.call_infos[0]
91
+ assert_equal('StackTest#test_call_sequence->StackClass#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->StackClass#a->StackClass#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->StackClass#a->StackClass#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->StackClass#a->StackClass#c->StackClass#b->Kernel#sleep', call_info.call_sequence)
104
+ assert_equal(0, call_info.children.length)
105
+
106
+ # Check StackClass#c
107
+ method = methods[3]
108
+ assert_equal('StackClass#c', method.full_name)
109
+ assert_equal(1, method.called)
110
+ assert_in_delta(5, method.total_time, 0.05)
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.05)
114
+ assert_equal(1, method.call_infos.length)
115
+
116
+ call_info = method.call_infos[0]
117
+ assert_equal('StackTest#test_call_sequence->StackClass#a->StackClass#c', call_info.call_sequence)
118
+ assert_equal(2, call_info.children.length)
119
+
120
+ # Check StackClass#b
121
+ method = methods[4]
122
+ assert_equal('StackClass#b', method.full_name)
123
+ assert_equal(2, method.called)
124
+ assert_in_delta(4, method.total_time, 0.05)
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.05)
128
+ assert_equal(2, method.call_infos.length)
129
+
130
+ call_info = method.call_infos[0]
131
+ assert_equal('StackTest#test_call_sequence->StackClass#a->StackClass#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->StackClass#a->StackClass#c->StackClass#b', call_info.call_sequence)
136
+ assert_equal(1, call_info.children.length)
137
+ end
138
+ end