ruby-prof 1.1.0-x64-mingw32 → 1.4.2-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES +48 -1
  3. data/Rakefile +2 -14
  4. data/bin/ruby-prof +100 -152
  5. data/ext/ruby_prof/extconf.rb +8 -28
  6. data/ext/ruby_prof/rp_aggregate_call_tree.c +59 -0
  7. data/ext/ruby_prof/rp_aggregate_call_tree.h +13 -0
  8. data/ext/ruby_prof/rp_allocation.c +67 -59
  9. data/ext/ruby_prof/rp_allocation.h +3 -3
  10. data/ext/ruby_prof/rp_call_tree.c +369 -0
  11. data/ext/ruby_prof/rp_call_tree.h +43 -0
  12. data/ext/ruby_prof/rp_call_trees.c +288 -0
  13. data/ext/ruby_prof/rp_call_trees.h +28 -0
  14. data/ext/ruby_prof/rp_measure_allocations.c +12 -14
  15. data/ext/ruby_prof/rp_measure_process_time.c +12 -14
  16. data/ext/ruby_prof/rp_measure_wall_time.c +17 -15
  17. data/ext/ruby_prof/rp_measurement.c +47 -40
  18. data/ext/ruby_prof/rp_measurement.h +7 -7
  19. data/ext/ruby_prof/rp_method.c +116 -255
  20. data/ext/ruby_prof/rp_method.h +31 -39
  21. data/ext/ruby_prof/rp_profile.c +316 -303
  22. data/ext/ruby_prof/rp_profile.h +1 -3
  23. data/ext/ruby_prof/rp_stack.c +122 -106
  24. data/ext/ruby_prof/rp_stack.h +17 -20
  25. data/ext/ruby_prof/rp_thread.c +136 -111
  26. data/ext/ruby_prof/rp_thread.h +12 -9
  27. data/ext/ruby_prof/ruby_prof.c +27 -23
  28. data/ext/ruby_prof/ruby_prof.h +9 -0
  29. data/ext/ruby_prof/vc/ruby_prof.sln +8 -0
  30. data/ext/ruby_prof/vc/ruby_prof.vcxproj +22 -7
  31. data/lib/2.7/ruby_prof.so +0 -0
  32. data/lib/ruby-prof.rb +5 -5
  33. data/lib/ruby-prof/assets/call_stack_printer.html.erb +4 -7
  34. data/lib/ruby-prof/assets/graph_printer.html.erb +5 -6
  35. data/lib/ruby-prof/{call_info.rb → call_tree.rb} +6 -6
  36. data/lib/ruby-prof/call_tree_visitor.rb +36 -0
  37. data/lib/ruby-prof/compatibility.rb +0 -10
  38. data/lib/ruby-prof/measurement.rb +5 -2
  39. data/lib/ruby-prof/method_info.rb +3 -15
  40. data/lib/ruby-prof/printers/abstract_printer.rb +12 -2
  41. data/lib/ruby-prof/printers/call_info_printer.rb +12 -10
  42. data/lib/ruby-prof/printers/call_stack_printer.rb +20 -22
  43. data/lib/ruby-prof/printers/call_tree_printer.rb +1 -1
  44. data/lib/ruby-prof/printers/dot_printer.rb +3 -3
  45. data/lib/ruby-prof/printers/flat_printer.rb +3 -2
  46. data/lib/ruby-prof/printers/graph_printer.rb +4 -5
  47. data/lib/ruby-prof/printers/multi_printer.rb +2 -2
  48. data/lib/ruby-prof/profile.rb +8 -4
  49. data/lib/ruby-prof/rack.rb +51 -127
  50. data/lib/ruby-prof/thread.rb +3 -18
  51. data/lib/ruby-prof/version.rb +1 -1
  52. data/ruby-prof.gemspec +7 -0
  53. data/test/alias_test.rb +42 -45
  54. data/test/basic_test.rb +0 -86
  55. data/test/{call_info_visitor_test.rb → call_tree_visitor_test.rb} +6 -5
  56. data/test/call_trees_test.rb +66 -0
  57. data/test/exclude_methods_test.rb +17 -12
  58. data/test/fiber_test.rb +95 -39
  59. data/test/gc_test.rb +36 -42
  60. data/test/inverse_call_tree_test.rb +175 -0
  61. data/test/line_number_test.rb +67 -70
  62. data/test/marshal_test.rb +7 -13
  63. data/test/measure_allocations_test.rb +224 -234
  64. data/test/measure_allocations_trace_test.rb +224 -234
  65. data/test/measure_memory_trace_test.rb +814 -469
  66. data/test/measure_process_time_test.rb +0 -64
  67. data/test/measure_times.rb +2 -0
  68. data/test/measure_wall_time_test.rb +34 -58
  69. data/test/pause_resume_test.rb +19 -10
  70. data/test/prime.rb +1 -3
  71. data/test/prime_script.rb +6 -0
  72. data/test/printer_call_stack_test.rb +0 -1
  73. data/test/printer_call_tree_test.rb +0 -1
  74. data/test/printer_flat_test.rb +61 -30
  75. data/test/printer_graph_html_test.rb +0 -1
  76. data/test/printer_graph_test.rb +3 -4
  77. data/test/printers_test.rb +2 -2
  78. data/test/printing_recursive_graph_test.rb +1 -1
  79. data/test/profile_test.rb +16 -0
  80. data/test/rack_test.rb +0 -64
  81. data/test/recursive_test.rb +50 -54
  82. data/test/start_stop_test.rb +19 -19
  83. data/test/test_helper.rb +6 -17
  84. data/test/thread_test.rb +11 -11
  85. data/test/unique_call_path_test.rb +25 -95
  86. metadata +22 -11
  87. data/ext/ruby_prof/rp_call_info.c +0 -271
  88. data/ext/ruby_prof/rp_call_info.h +0 -35
  89. data/lib/2.6.5/ruby_prof.so +0 -0
  90. data/lib/ruby-prof/call_info_visitor.rb +0 -38
  91. data/test/parser_timings.rb +0 -24
@@ -24,10 +24,6 @@ class MeasureMemoryTraceTest < TestCase
24
24
  thread = result.threads.first
25
25
  assert_in_delta(800, thread.total_time, 1)
26
26
 
27
- root_methods = thread.root_methods
28
- assert_equal(1, root_methods.count)
29
- assert_equal("MeasureMemoryTraceTest#test_memory", root_methods[0].full_name)
30
-
31
27
  methods = result.threads.first.methods.sort.reverse
32
28
  assert_equal(13, methods.length)
33
29
 
@@ -39,28 +35,22 @@ class MeasureMemoryTraceTest < TestCase
39
35
  assert_equal(0.0, method.self_time)
40
36
  assert_in_delta(800, method.children_time, 1)
41
37
 
42
- assert_equal(1, method.callers.length)
43
- call_info = method.callers[0]
44
- assert_nil(call_info.parent)
45
- assert_equal(800, call_info.total_time)
46
- assert_equal(0.0, call_info.wait_time)
47
- assert_equal(0.0, call_info.self_time)
48
- assert_equal(800, call_info.children_time)
49
-
50
- assert_equal(2, method.callees.length)
51
- call_info = method.callees[0]
52
- assert_equal('Class#new', call_info.target.full_name)
53
- assert_equal(40.0, call_info.total_time)
54
- assert_equal(0.0, call_info.wait_time)
55
- assert_equal(40.0, call_info.self_time)
56
- assert_equal(0.0, call_info.children_time)
57
-
58
- call_info = method.callees[1]
59
- assert_equal('Allocator#run', call_info.target.full_name)
60
- assert_equal(760.0, call_info.total_time)
61
- assert_equal(0.0, call_info.wait_time)
62
- assert_equal(0.0, call_info.self_time)
63
- assert_equal(760.0, call_info.children_time)
38
+ assert_equal(0, method.call_trees.callers.length)
39
+
40
+ assert_equal(2, method.call_trees.callees.length)
41
+ call_tree = method.call_trees.callees[0]
42
+ assert_equal('Class#new', call_tree.target.full_name)
43
+ assert_equal(40.0, call_tree.total_time)
44
+ assert_equal(0.0, call_tree.wait_time)
45
+ assert_equal(40.0, call_tree.self_time)
46
+ assert_equal(0.0, call_tree.children_time)
47
+
48
+ call_tree = method.call_trees.callees[1]
49
+ assert_equal('Allocator#run', call_tree.target.full_name)
50
+ assert_equal(760.0, call_tree.total_time)
51
+ assert_equal(0.0, call_tree.wait_time)
52
+ assert_equal(0.0, call_tree.self_time)
53
+ assert_equal(760.0, call_tree.children_time)
64
54
 
65
55
  # Method 1
66
56
  method = methods[1]
@@ -70,21 +60,21 @@ class MeasureMemoryTraceTest < TestCase
70
60
  assert_equal(0.0, method.self_time)
71
61
  assert_equal(760.0, method.children_time)
72
62
 
73
- assert_equal(1, method.callers.length)
74
- call_info = method.callers[0]
75
- assert_equal('MeasureMemoryTraceTest#test_memory', call_info.parent.full_name)
76
- assert_equal(760.0, call_info.total_time)
77
- assert_equal(0.0, call_info.wait_time)
78
- assert_equal(0.0, call_info.self_time)
79
- assert_equal(760.0, call_info.children_time)
80
-
81
- assert_equal(1, method.callees.length)
82
- call_info = method.callees[0]
83
- assert_equal('Allocator#internal_run', call_info.target.full_name)
84
- assert_equal(760.0, call_info.total_time)
85
- assert_equal(0.0, call_info.wait_time)
86
- assert_equal(0.0, call_info.self_time)
87
- assert_equal(760.0, call_info.children_time)
63
+ assert_equal(1, method.call_trees.callers.length)
64
+ call_tree = method.call_trees.callers[0]
65
+ assert_equal('MeasureMemoryTraceTest#test_memory', call_tree.parent.target.full_name)
66
+ assert_equal(760.0, call_tree.total_time)
67
+ assert_equal(0.0, call_tree.wait_time)
68
+ assert_equal(0.0, call_tree.self_time)
69
+ assert_equal(760.0, call_tree.children_time)
70
+
71
+ assert_equal(1, method.call_trees.callees.length)
72
+ call_tree = method.call_trees.callees[0]
73
+ assert_equal('Allocator#internal_run', call_tree.target.full_name)
74
+ assert_equal(760.0, call_tree.total_time)
75
+ assert_equal(0.0, call_tree.wait_time)
76
+ assert_equal(0.0, call_tree.self_time)
77
+ assert_equal(760.0, call_tree.children_time)
88
78
 
89
79
  # Method 2
90
80
  method = methods[2]
@@ -94,35 +84,35 @@ class MeasureMemoryTraceTest < TestCase
94
84
  assert_equal(0.0, method.self_time)
95
85
  assert_equal(760.0, method.children_time)
96
86
 
97
- assert_equal(1, method.callers.length)
98
- call_info = method.callers[0]
99
- assert_equal('Allocator#run', call_info.parent.full_name)
100
- assert_equal(760.0, call_info.total_time)
101
- assert_equal(0.0, call_info.wait_time)
102
- assert_equal(0.0, call_info.self_time)
103
- assert_equal(760.0, call_info.children_time)
104
-
105
- assert_equal(3, method.callees.length)
106
- call_info = method.callees[0]
107
- assert_equal('Allocator#make_arrays', call_info.target.full_name)
108
- assert_equal(400.0, call_info.total_time)
109
- assert_equal(0.0, call_info.wait_time)
110
- assert_equal(0.0, call_info.self_time)
111
- assert_equal(400.0, call_info.children_time)
112
-
113
- call_info = method.callees[1]
114
- assert_equal('Allocator#make_hashes', call_info.target.full_name)
115
- assert_equal(200.0, call_info.total_time)
116
- assert_equal(0.0, call_info.wait_time)
117
- assert_equal(0.0, call_info.self_time)
118
- assert_equal(200.0, call_info.children_time)
119
-
120
- call_info = method.callees[2]
121
- assert_equal('Allocator#make_strings', call_info.target.full_name)
122
- assert_equal(160.0, call_info.total_time)
123
- assert_equal(0.0, call_info.wait_time)
124
- assert_equal(40, call_info.self_time)
125
- assert_equal(120.0, call_info.children_time)
87
+ assert_equal(1, method.call_trees.callers.length)
88
+ call_tree = method.call_trees.callers[0]
89
+ assert_equal('Allocator#run', call_tree.parent.target.full_name)
90
+ assert_equal(760.0, call_tree.total_time)
91
+ assert_equal(0.0, call_tree.wait_time)
92
+ assert_equal(0.0, call_tree.self_time)
93
+ assert_equal(760.0, call_tree.children_time)
94
+
95
+ assert_equal(3, method.call_trees.callees.length)
96
+ call_tree = method.call_trees.callees[0]
97
+ assert_equal('Allocator#make_arrays', call_tree.target.full_name)
98
+ assert_equal(400.0, call_tree.total_time)
99
+ assert_equal(0.0, call_tree.wait_time)
100
+ assert_equal(0.0, call_tree.self_time)
101
+ assert_equal(400.0, call_tree.children_time)
102
+
103
+ call_tree = method.call_trees.callees[1]
104
+ assert_equal('Allocator#make_hashes', call_tree.target.full_name)
105
+ assert_equal(200.0, call_tree.total_time)
106
+ assert_equal(0.0, call_tree.wait_time)
107
+ assert_equal(0.0, call_tree.self_time)
108
+ assert_equal(200.0, call_tree.children_time)
109
+
110
+ call_tree = method.call_trees.callees[2]
111
+ assert_equal('Allocator#make_strings', call_tree.target.full_name)
112
+ assert_equal(160.0, call_tree.total_time)
113
+ assert_equal(0.0, call_tree.wait_time)
114
+ assert_equal(40, call_tree.self_time)
115
+ assert_equal(120.0, call_tree.children_time)
126
116
 
127
117
  # Method 3
128
118
  method = methods[3]
@@ -132,63 +122,63 @@ class MeasureMemoryTraceTest < TestCase
132
122
  assert_equal(680.0, method.self_time)
133
123
  assert_equal(40.0, method.children_time)
134
124
 
135
- assert_equal(4, method.callers.length)
136
- call_info = method.callers[0]
137
- assert_equal('MeasureMemoryTraceTest#test_memory', call_info.parent.full_name)
138
- assert_equal(40.0, call_info.total_time)
139
- assert_equal(0.0, call_info.wait_time)
140
- assert_equal(40.0, call_info.self_time)
141
- assert_equal(0.0, call_info.children_time)
142
-
143
- call_info = method.callers[1]
144
- assert_equal('Integer#times', call_info.parent.full_name)
145
- assert_equal(400.0, call_info.total_time)
146
- assert_equal(0.0, call_info.wait_time)
147
- assert_equal(400.0, call_info.self_time)
148
- assert_equal(0.0, call_info.children_time)
149
-
150
- call_info = method.callers[2]
151
- assert_equal('Allocator#make_hashes', call_info.parent.full_name)
152
- assert_equal(200.0, call_info.total_time)
153
- assert_equal(0.0, call_info.wait_time)
154
- assert_equal(200.0, call_info.self_time)
155
- assert_equal(0.0, call_info.children_time)
156
-
157
- call_info = method.callers[3]
158
- assert_equal('Allocator#make_strings', call_info.parent.full_name)
159
- assert_equal(80.0, call_info.total_time)
160
- assert_equal(0.0, call_info.wait_time)
161
- assert_equal(40.0, call_info.self_time)
162
- assert_equal(40.0, call_info.children_time)
163
-
164
- assert_equal(4, method.callees.length)
165
- call_info = method.callees[0]
166
- assert_equal('BasicObject#initialize', call_info.target.full_name)
167
- assert_equal(0.0, call_info.total_time)
168
- assert_equal(0.0, call_info.wait_time)
169
- assert_equal(0.0, call_info.self_time)
170
- assert_equal(0.0, call_info.children_time)
171
-
172
- call_info = method.callees[1]
173
- assert_equal('Array#initialize', call_info.target.full_name)
174
- assert_equal(0.0, call_info.total_time)
175
- assert_equal(0.0, call_info.wait_time)
176
- assert_equal(0.0, call_info.self_time)
177
- assert_equal(0.0, call_info.children_time)
178
-
179
- call_info = method.callees[2]
180
- assert_equal('Hash#initialize', call_info.target.full_name)
181
- assert_equal(0.0, call_info.total_time)
182
- assert_equal(0.0, call_info.wait_time)
183
- assert_equal(0.0, call_info.self_time)
184
- assert_equal(0.0, call_info.children_time)
185
-
186
- call_info = method.callees[3]
187
- assert_equal('String#initialize', call_info.target.full_name)
188
- assert_equal(40.0, call_info.total_time)
189
- assert_equal(0.0, call_info.wait_time)
190
- assert_equal(40.0, call_info.self_time)
191
- assert_equal(0.0, call_info.children_time)
125
+ assert_equal(4, method.call_trees.callers.length)
126
+ call_tree = method.call_trees.callers[0]
127
+ assert_equal('MeasureMemoryTraceTest#test_memory', call_tree.parent.target.full_name)
128
+ assert_equal(40.0, call_tree.total_time)
129
+ assert_equal(0.0, call_tree.wait_time)
130
+ assert_equal(40.0, call_tree.self_time)
131
+ assert_equal(0.0, call_tree.children_time)
132
+
133
+ call_tree = method.call_trees.callers[1]
134
+ assert_equal('Integer#times', call_tree.parent.target.full_name)
135
+ assert_equal(400.0, call_tree.total_time)
136
+ assert_equal(0.0, call_tree.wait_time)
137
+ assert_equal(400.0, call_tree.self_time)
138
+ assert_equal(0.0, call_tree.children_time)
139
+
140
+ call_tree = method.call_trees.callers[2]
141
+ assert_equal('Allocator#make_hashes', call_tree.parent.target.full_name)
142
+ assert_equal(200.0, call_tree.total_time)
143
+ assert_equal(0.0, call_tree.wait_time)
144
+ assert_equal(200.0, call_tree.self_time)
145
+ assert_equal(0.0, call_tree.children_time)
146
+
147
+ call_tree = method.call_trees.callers[3]
148
+ assert_equal('Allocator#make_strings', call_tree.parent.target.full_name)
149
+ assert_equal(80.0, call_tree.total_time)
150
+ assert_equal(0.0, call_tree.wait_time)
151
+ assert_equal(40.0, call_tree.self_time)
152
+ assert_equal(40.0, call_tree.children_time)
153
+
154
+ assert_equal(4, method.call_trees.callees.length)
155
+ call_tree = method.call_trees.callees[0]
156
+ assert_equal('BasicObject#initialize', call_tree.target.full_name)
157
+ assert_equal(0.0, call_tree.total_time)
158
+ assert_equal(0.0, call_tree.wait_time)
159
+ assert_equal(0.0, call_tree.self_time)
160
+ assert_equal(0.0, call_tree.children_time)
161
+
162
+ call_tree = method.call_trees.callees[1]
163
+ assert_equal('Array#initialize', call_tree.target.full_name)
164
+ assert_equal(0.0, call_tree.total_time)
165
+ assert_equal(0.0, call_tree.wait_time)
166
+ assert_equal(0.0, call_tree.self_time)
167
+ assert_equal(0.0, call_tree.children_time)
168
+
169
+ call_tree = method.call_trees.callees[2]
170
+ assert_equal('Hash#initialize', call_tree.target.full_name)
171
+ assert_equal(0.0, call_tree.total_time)
172
+ assert_equal(0.0, call_tree.wait_time)
173
+ assert_equal(0.0, call_tree.self_time)
174
+ assert_equal(0.0, call_tree.children_time)
175
+
176
+ call_tree = method.call_trees.callees[3]
177
+ assert_equal('String#initialize', call_tree.target.full_name)
178
+ assert_equal(40.0, call_tree.total_time)
179
+ assert_equal(0.0, call_tree.wait_time)
180
+ assert_equal(40.0, call_tree.self_time)
181
+ assert_equal(0.0, call_tree.children_time)
192
182
 
193
183
  # Method 4
194
184
  method = methods[4]
@@ -198,21 +188,21 @@ class MeasureMemoryTraceTest < TestCase
198
188
  assert_equal(0.0, method.self_time)
199
189
  assert_equal(400.0, method.children_time)
200
190
 
201
- assert_equal(1, method.callers.length)
202
- call_info = method.callers[0]
203
- assert_equal('Allocator#internal_run', call_info.parent.full_name)
204
- assert_equal(400.0, call_info.total_time)
205
- assert_equal(0.0, call_info.wait_time)
206
- assert_equal(0.0, call_info.self_time)
207
- assert_equal(400.0, call_info.children_time)
208
-
209
- assert_equal(1, method.callees.length)
210
- call_info = method.callees[0]
211
- assert_equal('Integer#times', call_info.target.full_name)
212
- assert_equal(400.0, call_info.total_time)
213
- assert_equal(0.0, call_info.wait_time)
214
- assert_equal(0.0, call_info.self_time)
215
- assert_equal(400.0, call_info.children_time)
191
+ assert_equal(1, method.call_trees.callers.length)
192
+ call_tree = method.call_trees.callers[0]
193
+ assert_equal('Allocator#internal_run', call_tree.parent.target.full_name)
194
+ assert_equal(400.0, call_tree.total_time)
195
+ assert_equal(0.0, call_tree.wait_time)
196
+ assert_equal(0.0, call_tree.self_time)
197
+ assert_equal(400.0, call_tree.children_time)
198
+
199
+ assert_equal(1, method.call_trees.callees.length)
200
+ call_tree = method.call_trees.callees[0]
201
+ assert_equal('Integer#times', call_tree.target.full_name)
202
+ assert_equal(400.0, call_tree.total_time)
203
+ assert_equal(0.0, call_tree.wait_time)
204
+ assert_equal(0.0, call_tree.self_time)
205
+ assert_equal(400.0, call_tree.children_time)
216
206
 
217
207
  # Method 5
218
208
  method = methods[5]
@@ -222,21 +212,21 @@ class MeasureMemoryTraceTest < TestCase
222
212
  assert_equal(0.0, method.self_time)
223
213
  assert_equal(400.0, method.children_time)
224
214
 
225
- assert_equal(1, method.callers.length)
226
- call_info = method.callers[0]
227
- assert_equal('Allocator#make_arrays', call_info.parent.full_name)
228
- assert_equal(400.0, call_info.total_time)
229
- assert_equal(0.0, call_info.wait_time)
230
- assert_equal(0.0, call_info.self_time)
231
- assert_equal(400.0, call_info.children_time)
232
-
233
- assert_equal(1, method.callees.length)
234
- call_info = method.callees[0]
235
- assert_equal('Class#new', call_info.target.full_name)
236
- assert_equal(400.0, call_info.total_time)
237
- assert_equal(0.0, call_info.wait_time)
238
- assert_equal(400.0, call_info.self_time)
239
- assert_equal(0.0, call_info.children_time)
215
+ assert_equal(1, method.call_trees.callers.length)
216
+ call_tree = method.call_trees.callers[0]
217
+ assert_equal('Allocator#make_arrays', call_tree.parent.target.full_name)
218
+ assert_equal(400.0, call_tree.total_time)
219
+ assert_equal(0.0, call_tree.wait_time)
220
+ assert_equal(0.0, call_tree.self_time)
221
+ assert_equal(400.0, call_tree.children_time)
222
+
223
+ assert_equal(1, method.call_trees.callees.length)
224
+ call_tree = method.call_trees.callees[0]
225
+ assert_equal('Class#new', call_tree.target.full_name)
226
+ assert_equal(400.0, call_tree.total_time)
227
+ assert_equal(0.0, call_tree.wait_time)
228
+ assert_equal(400.0, call_tree.self_time)
229
+ assert_equal(0.0, call_tree.children_time)
240
230
 
241
231
  # Method 6
242
232
  method = methods[6]
@@ -246,21 +236,21 @@ class MeasureMemoryTraceTest < TestCase
246
236
  assert_equal(0.0, method.self_time)
247
237
  assert_equal(200.0, method.children_time)
248
238
 
249
- assert_equal(1, method.callers.length)
250
- call_info = method.callers[0]
251
- assert_equal('Allocator#internal_run', call_info.parent.full_name)
252
- assert_equal(200.0, call_info.total_time)
253
- assert_equal(0.0, call_info.wait_time)
254
- assert_equal(0.0, call_info.self_time)
255
- assert_equal(200.0, call_info.children_time)
256
-
257
- assert_equal(1, method.callees.length)
258
- call_info = method.callees[0]
259
- assert_equal('Class#new', call_info.target.full_name)
260
- assert_equal(200.0, call_info.total_time)
261
- assert_equal(0.0, call_info.wait_time)
262
- assert_equal(200.0, call_info.self_time)
263
- assert_equal(0.0, call_info.children_time)
239
+ assert_equal(1, method.call_trees.callers.length)
240
+ call_tree = method.call_trees.callers[0]
241
+ assert_equal('Allocator#internal_run', call_tree.parent.target.full_name)
242
+ assert_equal(200.0, call_tree.total_time)
243
+ assert_equal(0.0, call_tree.wait_time)
244
+ assert_equal(0.0, call_tree.self_time)
245
+ assert_equal(200.0, call_tree.children_time)
246
+
247
+ assert_equal(1, method.call_trees.callees.length)
248
+ call_tree = method.call_trees.callees[0]
249
+ assert_equal('Class#new', call_tree.target.full_name)
250
+ assert_equal(200.0, call_tree.total_time)
251
+ assert_equal(0.0, call_tree.wait_time)
252
+ assert_equal(200.0, call_tree.self_time)
253
+ assert_equal(0.0, call_tree.children_time)
264
254
 
265
255
  # Method 7
266
256
  method = methods[7]
@@ -270,28 +260,28 @@ class MeasureMemoryTraceTest < TestCase
270
260
  assert_equal(40.0, method.self_time)
271
261
  assert_equal(120.0, method.children_time)
272
262
 
273
- assert_equal(1, method.callers.length)
274
- call_info = method.callers[0]
275
- assert_equal('Allocator#internal_run', call_info.parent.full_name)
276
- assert_equal(160.0, call_info.total_time)
277
- assert_equal(0.0, call_info.wait_time)
278
- assert_equal(40.0, call_info.self_time)
279
- assert_equal(120.0, call_info.children_time)
280
-
281
- assert_equal(2, method.callees.length)
282
- call_info = method.callees[0]
283
- assert_equal('String#*', call_info.target.full_name)
284
- assert_equal(40.0, call_info.total_time)
285
- assert_equal(0.0, call_info.wait_time)
286
- assert_equal(40.0, call_info.self_time)
287
- assert_equal(0.0, call_info.children_time)
288
-
289
- call_info = method.callees[1]
290
- assert_equal('Class#new', call_info.target.full_name)
291
- assert_equal(80.0, call_info.total_time)
292
- assert_equal(0.0, call_info.wait_time)
293
- assert_equal(40.0, call_info.self_time)
294
- assert_equal(40.0, call_info.children_time)
263
+ assert_equal(1, method.call_trees.callers.length)
264
+ call_tree = method.call_trees.callers[0]
265
+ assert_equal('Allocator#internal_run', call_tree.parent.target.full_name)
266
+ assert_equal(160.0, call_tree.total_time)
267
+ assert_equal(0.0, call_tree.wait_time)
268
+ assert_equal(40.0, call_tree.self_time)
269
+ assert_equal(120.0, call_tree.children_time)
270
+
271
+ assert_equal(2, method.call_trees.callees.length)
272
+ call_tree = method.call_trees.callees[0]
273
+ assert_equal('String#*', call_tree.target.full_name)
274
+ assert_equal(40.0, call_tree.total_time)
275
+ assert_equal(0.0, call_tree.wait_time)
276
+ assert_equal(40.0, call_tree.self_time)
277
+ assert_equal(0.0, call_tree.children_time)
278
+
279
+ call_tree = method.call_trees.callees[1]
280
+ assert_equal('Class#new', call_tree.target.full_name)
281
+ assert_equal(80.0, call_tree.total_time)
282
+ assert_equal(0.0, call_tree.wait_time)
283
+ assert_equal(40.0, call_tree.self_time)
284
+ assert_equal(40.0, call_tree.children_time)
295
285
 
296
286
  # Method 8
297
287
  method = methods[8]
@@ -301,15 +291,15 @@ class MeasureMemoryTraceTest < TestCase
301
291
  assert_equal(40.0, method.self_time)
302
292
  assert_equal(0.0, method.children_time)
303
293
 
304
- assert_equal(1, method.callers.length)
305
- call_info = method.callers[0]
306
- assert_equal('Allocator#make_strings', call_info.parent.full_name)
307
- assert_equal(40.0, call_info.total_time)
308
- assert_equal(0.0, call_info.wait_time)
309
- assert_equal(40.0, call_info.self_time)
310
- assert_equal(0.0, call_info.children_time)
294
+ assert_equal(1, method.call_trees.callers.length)
295
+ call_tree = method.call_trees.callers[0]
296
+ assert_equal('Allocator#make_strings', call_tree.parent.target.full_name)
297
+ assert_equal(40.0, call_tree.total_time)
298
+ assert_equal(0.0, call_tree.wait_time)
299
+ assert_equal(40.0, call_tree.self_time)
300
+ assert_equal(0.0, call_tree.children_time)
311
301
 
312
- assert_equal(0.0, method.callees.length)
302
+ assert_equal(0.0, method.call_trees.callees.length)
313
303
 
314
304
  # Method 9
315
305
  method = methods[9]
@@ -319,15 +309,15 @@ class MeasureMemoryTraceTest < TestCase
319
309
  assert_equal(40.0, method.self_time)
320
310
  assert_equal(0.0, method.children_time)
321
311
 
322
- assert_equal(1, method.callers.length)
323
- call_info = method.callers[0]
324
- assert_equal('Class#new', call_info.parent.full_name)
325
- assert_equal(40.0, call_info.total_time)
326
- assert_equal(0.0, call_info.wait_time)
327
- assert_equal(40.0, call_info.self_time)
328
- assert_equal(0.0, call_info.children_time)
312
+ assert_equal(1, method.call_trees.callers.length)
313
+ call_tree = method.call_trees.callers[0]
314
+ assert_equal('Class#new', call_tree.parent.target.full_name)
315
+ assert_equal(40.0, call_tree.total_time)
316
+ assert_equal(0.0, call_tree.wait_time)
317
+ assert_equal(40.0, call_tree.self_time)
318
+ assert_equal(0.0, call_tree.children_time)
329
319
 
330
- assert_equal(0.0, method.callees.length)
320
+ assert_equal(0.0, method.call_trees.callees.length)
331
321
 
332
322
  # Method 10
333
323
  method = methods[10]
@@ -337,15 +327,15 @@ class MeasureMemoryTraceTest < TestCase
337
327
  assert_equal(0.0, method.self_time)
338
328
  assert_equal(0.0, method.children_time)
339
329
 
340
- assert_equal(1, method.callers.length)
341
- call_info = method.callers[0]
342
- assert_equal('Class#new', call_info.parent.full_name)
343
- assert_equal(0.0, call_info.total_time)
344
- assert_equal(0.0, call_info.wait_time)
345
- assert_equal(0.0, call_info.self_time)
346
- assert_equal(0.0, call_info.children_time)
330
+ assert_equal(1, method.call_trees.callers.length)
331
+ call_tree = method.call_trees.callers[0]
332
+ assert_equal('Class#new', call_tree.parent.target.full_name)
333
+ assert_equal(0.0, call_tree.total_time)
334
+ assert_equal(0.0, call_tree.wait_time)
335
+ assert_equal(0.0, call_tree.self_time)
336
+ assert_equal(0.0, call_tree.children_time)
347
337
 
348
- assert_equal(0.0, method.callees.length)
338
+ assert_equal(0.0, method.call_trees.callees.length)
349
339
 
350
340
  # Method 11
351
341
  method = methods[11]
@@ -355,15 +345,15 @@ class MeasureMemoryTraceTest < TestCase
355
345
  assert_equal(0.0, method.self_time)
356
346
  assert_equal(0.0, method.children_time)
357
347
 
358
- assert_equal(1, method.callers.length)
359
- call_info = method.callers[0]
360
- assert_equal('Class#new', call_info.parent.full_name)
361
- assert_equal(0.0, call_info.total_time)
362
- assert_equal(0.0, call_info.wait_time)
363
- assert_equal(0.0, call_info.self_time)
364
- assert_equal(0.0, call_info.children_time)
348
+ assert_equal(1, method.call_trees.callers.length)
349
+ call_tree = method.call_trees.callers[0]
350
+ assert_equal('Class#new', call_tree.parent.target.full_name)
351
+ assert_equal(0.0, call_tree.total_time)
352
+ assert_equal(0.0, call_tree.wait_time)
353
+ assert_equal(0.0, call_tree.self_time)
354
+ assert_equal(0.0, call_tree.children_time)
365
355
 
366
- assert_equal(0.0, method.callees.length)
356
+ assert_equal(0.0, method.call_trees.callees.length)
367
357
 
368
358
  # Method 12
369
359
  method = methods[12]
@@ -373,17 +363,17 @@ class MeasureMemoryTraceTest < TestCase
373
363
  assert_equal(0.0, method.self_time)
374
364
  assert_equal(0.0, method.children_time)
375
365
 
376
- assert_equal(1, method.callers.length)
377
- call_info = method.callers[0]
378
- assert_equal('Class#new', call_info.parent.full_name)
379
- assert_equal(0.0, call_info.total_time)
380
- assert_equal(0.0, call_info.wait_time)
381
- assert_equal(0.0, call_info.self_time)
382
- assert_equal(0.0, call_info.children_time)
366
+ assert_equal(1, method.call_trees.callers.length)
367
+ call_tree = method.call_trees.callers[0]
368
+ assert_equal('Class#new', call_tree.parent.target.full_name)
369
+ assert_equal(0.0, call_tree.total_time)
370
+ assert_equal(0.0, call_tree.wait_time)
371
+ assert_equal(0.0, call_tree.self_time)
372
+ assert_equal(0.0, call_tree.children_time)
383
373
 
384
- assert_equal(0.0, method.callees.length)
374
+ assert_equal(0.0, method.call_trees.callees.length)
385
375
  end
386
- else
376
+ elsif Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.7')
387
377
  def test_memory
388
378
  result = RubyProf.profile do
389
379
  allocator = Allocator.new
@@ -391,11 +381,12 @@ class MeasureMemoryTraceTest < TestCase
391
381
  end
392
382
 
393
383
  thread = result.threads.first
394
- assert_in_delta(1760, thread.total_time, 1)
395
384
 
396
- root_methods = thread.root_methods
397
- assert_equal(1, root_methods.count)
398
- assert_equal("MeasureMemoryTraceTest#test_memory", root_methods[0].full_name)
385
+ if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.7.0')
386
+ assert_in_delta(800, thread.total_time, 1)
387
+ else
388
+ assert_in_delta(1760, thread.total_time, 1)
389
+ end
399
390
 
400
391
  methods = result.threads.first.methods.sort.reverse
401
392
  assert_equal(13, methods.length)
@@ -404,32 +395,27 @@ class MeasureMemoryTraceTest < TestCase
404
395
  method = methods[0]
405
396
  assert_equal('MeasureMemoryTraceTest#test_memory', method.full_name)
406
397
  assert_in_delta(1760, method.total_time, 1)
398
+
407
399
  assert_equal(0.0, method.wait_time)
408
400
  assert_equal(0.0, method.self_time)
409
401
  assert_in_delta(1760, method.children_time, 1)
410
402
 
411
- assert_equal(1, method.callers.length)
412
- call_info = method.callers[0]
413
- assert_nil(call_info.parent)
414
- assert_equal(1760, call_info.total_time)
415
- assert_equal(0.0, call_info.wait_time)
416
- assert_equal(0.0, call_info.self_time)
417
- assert_equal(1760, call_info.children_time)
418
-
419
- assert_equal(2, method.callees.length)
420
- call_info = method.callees[0]
421
- assert_equal('Class#new', call_info.target.full_name)
422
- assert_equal(40.0, call_info.total_time)
423
- assert_equal(0.0, call_info.wait_time)
424
- assert_equal(40.0, call_info.self_time)
425
- assert_equal(0.0, call_info.children_time)
426
-
427
- call_info = method.callees[1]
428
- assert_equal('Allocator#run', call_info.target.full_name)
429
- assert_equal(1720.0, call_info.total_time)
430
- assert_equal(0.0, call_info.wait_time)
431
- assert_equal(0.0, call_info.self_time)
432
- assert_equal(1720.0, call_info.children_time)
403
+ assert_equal(0, method.call_trees.callers.length)
404
+
405
+ assert_equal(2, method.call_trees.callees.length)
406
+ call_tree = method.call_trees.callees[0]
407
+ assert_equal('Class#new', call_tree.target.full_name)
408
+ assert_equal(40.0, call_tree.total_time)
409
+ assert_equal(0.0, call_tree.wait_time)
410
+ assert_equal(40.0, call_tree.self_time)
411
+ assert_equal(0.0, call_tree.children_time)
412
+
413
+ call_tree = method.call_trees.callees[1]
414
+ assert_equal('Allocator#run', call_tree.target.full_name)
415
+ assert_equal(1720.0, call_tree.total_time)
416
+ assert_equal(0.0, call_tree.wait_time)
417
+ assert_equal(0.0, call_tree.self_time)
418
+ assert_equal(1720.0, call_tree.children_time)
433
419
 
434
420
  # Method 1
435
421
  method = methods[1]
@@ -439,21 +425,21 @@ class MeasureMemoryTraceTest < TestCase
439
425
  assert_equal(0.0, method.self_time)
440
426
  assert_equal(1720.0, method.children_time)
441
427
 
442
- assert_equal(1, method.callers.length)
443
- call_info = method.callers[0]
444
- assert_equal('MeasureMemoryTraceTest#test_memory', call_info.parent.full_name)
445
- assert_equal(1720.0, call_info.total_time)
446
- assert_equal(0.0, call_info.wait_time)
447
- assert_equal(0.0, call_info.self_time)
448
- assert_equal(1720.0, call_info.children_time)
449
-
450
- assert_equal(1, method.callees.length)
451
- call_info = method.callees[0]
452
- assert_equal('Allocator#internal_run', call_info.target.full_name)
453
- assert_equal(1720.0, call_info.total_time)
454
- assert_equal(0.0, call_info.wait_time)
455
- assert_equal(0.0, call_info.self_time)
456
- assert_equal(1720.0, call_info.children_time)
428
+ assert_equal(1, method.call_trees.callers.length)
429
+ call_tree = method.call_trees.callers[0]
430
+ assert_equal('MeasureMemoryTraceTest#test_memory', call_tree.parent.target.full_name)
431
+ assert_equal(1720.0, call_tree.total_time)
432
+ assert_equal(0.0, call_tree.wait_time)
433
+ assert_equal(0.0, call_tree.self_time)
434
+ assert_equal(1720.0, call_tree.children_time)
435
+
436
+ assert_equal(1, method.call_trees.callees.length)
437
+ call_tree = method.call_trees.callees[0]
438
+ assert_equal('Allocator#internal_run', call_tree.target.full_name)
439
+ assert_equal(1720.0, call_tree.total_time)
440
+ assert_equal(0.0, call_tree.wait_time)
441
+ assert_equal(0.0, call_tree.self_time)
442
+ assert_equal(1720.0, call_tree.children_time)
457
443
 
458
444
  # Method 2
459
445
  method = methods[2]
@@ -463,35 +449,35 @@ class MeasureMemoryTraceTest < TestCase
463
449
  assert_equal(0.0, method.self_time)
464
450
  assert_equal(1720.0, method.children_time)
465
451
 
466
- assert_equal(1, method.callers.length)
467
- call_info = method.callers[0]
468
- assert_equal('Allocator#run', call_info.parent.full_name)
469
- assert_equal(1720.0, call_info.total_time)
470
- assert_equal(0.0, call_info.wait_time)
471
- assert_equal(0.0, call_info.self_time)
472
- assert_equal(1720.0, call_info.children_time)
473
-
474
- assert_equal(3, method.callees.length)
475
- call_info = method.callees[0]
476
- assert_equal('Allocator#make_arrays', call_info.target.full_name)
477
- assert_equal(400.0, call_info.total_time)
478
- assert_equal(0.0, call_info.wait_time)
479
- assert_equal(0.0, call_info.self_time)
480
- assert_equal(400.0, call_info.children_time)
481
-
482
- call_info = method.callees[1]
483
- assert_equal('Allocator#make_hashes', call_info.target.full_name)
484
- assert_equal(1160.0, call_info.total_time)
485
- assert_equal(0.0, call_info.wait_time)
486
- assert_equal(0.0, call_info.self_time)
487
- assert_equal(1160.0, call_info.children_time)
488
-
489
- call_info = method.callees[2]
490
- assert_equal('Allocator#make_strings', call_info.target.full_name)
491
- assert_equal(160.0, call_info.total_time)
492
- assert_equal(0.0, call_info.wait_time)
493
- assert_equal(40, call_info.self_time)
494
- assert_equal(120.0, call_info.children_time)
452
+ assert_equal(1, method.call_trees.callers.length)
453
+ call_tree = method.call_trees.callers[0]
454
+ assert_equal('Allocator#run', call_tree.parent.target.full_name)
455
+ assert_equal(1720.0, call_tree.total_time)
456
+ assert_equal(0.0, call_tree.wait_time)
457
+ assert_equal(0.0, call_tree.self_time)
458
+ assert_equal(1720.0, call_tree.children_time)
459
+
460
+ assert_equal(3, method.call_trees.callees.length)
461
+ call_tree = method.call_trees.callees[0]
462
+ assert_equal('Allocator#make_arrays', call_tree.target.full_name)
463
+ assert_equal(400.0, call_tree.total_time)
464
+ assert_equal(0.0, call_tree.wait_time)
465
+ assert_equal(0.0, call_tree.self_time)
466
+ assert_equal(400.0, call_tree.children_time)
467
+
468
+ call_tree = method.call_trees.callees[1]
469
+ assert_equal('Allocator#make_hashes', call_tree.target.full_name)
470
+ assert_equal(1160.0, call_tree.total_time)
471
+ assert_equal(0.0, call_tree.wait_time)
472
+ assert_equal(0.0, call_tree.self_time)
473
+ assert_equal(1160.0, call_tree.children_time)
474
+
475
+ call_tree = method.call_trees.callees[2]
476
+ assert_equal('Allocator#make_strings', call_tree.target.full_name)
477
+ assert_equal(160.0, call_tree.total_time)
478
+ assert_equal(0.0, call_tree.wait_time)
479
+ assert_equal(40, call_tree.self_time)
480
+ assert_equal(120.0, call_tree.children_time)
495
481
 
496
482
  # Method 3
497
483
  method = methods[3]
@@ -501,63 +487,63 @@ class MeasureMemoryTraceTest < TestCase
501
487
  assert_equal(1640.0, method.self_time)
502
488
  assert_equal(40.0, method.children_time)
503
489
 
504
- assert_equal(4, method.callers.length)
505
- call_info = method.callers[0]
506
- assert_equal('MeasureMemoryTraceTest#test_memory', call_info.parent.full_name)
507
- assert_equal(40.0, call_info.total_time)
508
- assert_equal(0.0, call_info.wait_time)
509
- assert_equal(40.0, call_info.self_time)
510
- assert_equal(0.0, call_info.children_time)
511
-
512
- call_info = method.callers[1]
513
- assert_equal('Integer#times', call_info.parent.full_name)
514
- assert_equal(400.0, call_info.total_time)
515
- assert_equal(0.0, call_info.wait_time)
516
- assert_equal(400.0, call_info.self_time)
517
- assert_equal(0.0, call_info.children_time)
518
-
519
- call_info = method.callers[2]
520
- assert_equal('Allocator#make_hashes', call_info.parent.full_name)
521
- assert_equal(1160.0, call_info.total_time)
522
- assert_equal(0.0, call_info.wait_time)
523
- assert_equal(1160.0, call_info.self_time)
524
- assert_equal(0.0, call_info.children_time)
525
-
526
- call_info = method.callers[3]
527
- assert_equal('Allocator#make_strings', call_info.parent.full_name)
528
- assert_equal(80.0, call_info.total_time)
529
- assert_equal(0.0, call_info.wait_time)
530
- assert_equal(40.0, call_info.self_time)
531
- assert_equal(40.0, call_info.children_time)
532
-
533
- assert_equal(4, method.callees.length)
534
- call_info = method.callees[0]
535
- assert_equal('BasicObject#initialize', call_info.target.full_name)
536
- assert_equal(0.0, call_info.total_time)
537
- assert_equal(0.0, call_info.wait_time)
538
- assert_equal(0.0, call_info.self_time)
539
- assert_equal(0.0, call_info.children_time)
540
-
541
- call_info = method.callees[1]
542
- assert_equal('Array#initialize', call_info.target.full_name)
543
- assert_equal(0.0, call_info.total_time)
544
- assert_equal(0.0, call_info.wait_time)
545
- assert_equal(0.0, call_info.self_time)
546
- assert_equal(0.0, call_info.children_time)
547
-
548
- call_info = method.callees[2]
549
- assert_equal('Hash#initialize', call_info.target.full_name)
550
- assert_equal(0.0, call_info.total_time)
551
- assert_equal(0.0, call_info.wait_time)
552
- assert_equal(0.0, call_info.self_time)
553
- assert_equal(0.0, call_info.children_time)
554
-
555
- call_info = method.callees[3]
556
- assert_equal('String#initialize', call_info.target.full_name)
557
- assert_equal(40.0, call_info.total_time)
558
- assert_equal(0.0, call_info.wait_time)
559
- assert_equal(40.0, call_info.self_time)
560
- assert_equal(0.0, call_info.children_time)
490
+ assert_equal(4, method.call_trees.callers.length)
491
+ call_tree = method.call_trees.callers[0]
492
+ assert_equal('MeasureMemoryTraceTest#test_memory', call_tree.parent.target.full_name)
493
+ assert_equal(40.0, call_tree.total_time)
494
+ assert_equal(0.0, call_tree.wait_time)
495
+ assert_equal(40.0, call_tree.self_time)
496
+ assert_equal(0.0, call_tree.children_time)
497
+
498
+ call_tree = method.call_trees.callers[1]
499
+ assert_equal('Integer#times', call_tree.parent.target.full_name)
500
+ assert_equal(400.0, call_tree.total_time)
501
+ assert_equal(0.0, call_tree.wait_time)
502
+ assert_equal(400.0, call_tree.self_time)
503
+ assert_equal(0.0, call_tree.children_time)
504
+
505
+ call_tree = method.call_trees.callers[2]
506
+ assert_equal('Allocator#make_hashes', call_tree.parent.target.full_name)
507
+ assert_equal(1160.0, call_tree.total_time)
508
+ assert_equal(0.0, call_tree.wait_time)
509
+ assert_equal(1160.0, call_tree.self_time)
510
+ assert_equal(0.0, call_tree.children_time)
511
+
512
+ call_tree = method.call_trees.callers[3]
513
+ assert_equal('Allocator#make_strings', call_tree.parent.target.full_name)
514
+ assert_equal(80.0, call_tree.total_time)
515
+ assert_equal(0.0, call_tree.wait_time)
516
+ assert_equal(40.0, call_tree.self_time)
517
+ assert_equal(40.0, call_tree.children_time)
518
+
519
+ assert_equal(4, method.call_trees.callees.length)
520
+ call_tree = method.call_trees.callees[0]
521
+ assert_equal('BasicObject#initialize', call_tree.target.full_name)
522
+ assert_equal(0.0, call_tree.total_time)
523
+ assert_equal(0.0, call_tree.wait_time)
524
+ assert_equal(0.0, call_tree.self_time)
525
+ assert_equal(0.0, call_tree.children_time)
526
+
527
+ call_tree = method.call_trees.callees[1]
528
+ assert_equal('Array#initialize', call_tree.target.full_name)
529
+ assert_equal(0.0, call_tree.total_time)
530
+ assert_equal(0.0, call_tree.wait_time)
531
+ assert_equal(0.0, call_tree.self_time)
532
+ assert_equal(0.0, call_tree.children_time)
533
+
534
+ call_tree = method.call_trees.callees[2]
535
+ assert_equal('Hash#initialize', call_tree.target.full_name)
536
+ assert_equal(0.0, call_tree.total_time)
537
+ assert_equal(0.0, call_tree.wait_time)
538
+ assert_equal(0.0, call_tree.self_time)
539
+ assert_equal(0.0, call_tree.children_time)
540
+
541
+ call_tree = method.call_trees.callees[3]
542
+ assert_equal('String#initialize', call_tree.target.full_name)
543
+ assert_equal(40.0, call_tree.total_time)
544
+ assert_equal(0.0, call_tree.wait_time)
545
+ assert_equal(40.0, call_tree.self_time)
546
+ assert_equal(0.0, call_tree.children_time)
561
547
 
562
548
  # Method 4
563
549
  method = methods[4]
@@ -567,21 +553,21 @@ class MeasureMemoryTraceTest < TestCase
567
553
  assert_equal(0.0, method.self_time)
568
554
  assert_equal(1160.0, method.children_time)
569
555
 
570
- assert_equal(1, method.callers.length)
571
- call_info = method.callers[0]
572
- assert_equal('Allocator#internal_run', call_info.parent.full_name)
573
- assert_equal(1160.0, call_info.total_time)
574
- assert_equal(0.0, call_info.wait_time)
575
- assert_equal(0.0, call_info.self_time)
576
- assert_equal(1160.0, call_info.children_time)
577
-
578
- assert_equal(1, method.callees.length)
579
- call_info = method.callees[0]
580
- assert_equal('Class#new', call_info.target.full_name)
581
- assert_equal(1160.0, call_info.total_time)
582
- assert_equal(0.0, call_info.wait_time)
583
- assert_equal(1160.0, call_info.self_time)
584
- assert_equal(0.0, call_info.children_time)
556
+ assert_equal(1, method.call_trees.callers.length)
557
+ call_tree = method.call_trees.callers[0]
558
+ assert_equal('Allocator#internal_run', call_tree.parent.target.full_name)
559
+ assert_equal(1160.0, call_tree.total_time)
560
+ assert_equal(0.0, call_tree.wait_time)
561
+ assert_equal(0.0, call_tree.self_time)
562
+ assert_equal(1160.0, call_tree.children_time)
563
+
564
+ assert_equal(1, method.call_trees.callees.length)
565
+ call_tree = method.call_trees.callees[0]
566
+ assert_equal('Class#new', call_tree.target.full_name)
567
+ assert_equal(1160.0, call_tree.total_time)
568
+ assert_equal(0.0, call_tree.wait_time)
569
+ assert_equal(1160.0, call_tree.self_time)
570
+ assert_equal(0.0, call_tree.children_time)
585
571
 
586
572
  # Method 5
587
573
  method = methods[5]
@@ -591,21 +577,21 @@ class MeasureMemoryTraceTest < TestCase
591
577
  assert_equal(0.0, method.self_time)
592
578
  assert_equal(400.0, method.children_time)
593
579
 
594
- assert_equal(1, method.callers.length)
595
- call_info = method.callers[0]
596
- assert_equal('Allocator#internal_run', call_info.parent.full_name)
597
- assert_equal(400.0, call_info.total_time)
598
- assert_equal(0.0, call_info.wait_time)
599
- assert_equal(0.0, call_info.self_time)
600
- assert_equal(400.0, call_info.children_time)
601
-
602
- assert_equal(1, method.callees.length)
603
- call_info = method.callees[0]
604
- assert_equal('Integer#times', call_info.target.full_name)
605
- assert_equal(400.0, call_info.total_time)
606
- assert_equal(0.0, call_info.wait_time)
607
- assert_equal(0.0, call_info.self_time)
608
- assert_equal(400.0, call_info.children_time)
580
+ assert_equal(1, method.call_trees.callers.length)
581
+ call_tree = method.call_trees.callers[0]
582
+ assert_equal('Allocator#internal_run', call_tree.parent.target.full_name)
583
+ assert_equal(400.0, call_tree.total_time)
584
+ assert_equal(0.0, call_tree.wait_time)
585
+ assert_equal(0.0, call_tree.self_time)
586
+ assert_equal(400.0, call_tree.children_time)
587
+
588
+ assert_equal(1, method.call_trees.callees.length)
589
+ call_tree = method.call_trees.callees[0]
590
+ assert_equal('Integer#times', call_tree.target.full_name)
591
+ assert_equal(400.0, call_tree.total_time)
592
+ assert_equal(0.0, call_tree.wait_time)
593
+ assert_equal(0.0, call_tree.self_time)
594
+ assert_equal(400.0, call_tree.children_time)
609
595
 
610
596
  # Method 6
611
597
  method = methods[6]
@@ -615,21 +601,380 @@ class MeasureMemoryTraceTest < TestCase
615
601
  assert_equal(0.0, method.self_time)
616
602
  assert_equal(400.0, method.children_time)
617
603
 
618
- assert_equal(1, method.callers.length)
619
- call_info = method.callers[0]
620
- assert_equal('Allocator#make_arrays', call_info.parent.full_name)
621
- assert_equal(400.0, call_info.total_time)
622
- assert_equal(0.0, call_info.wait_time)
623
- assert_equal(0.0, call_info.self_time)
624
- assert_equal(400.0, call_info.children_time)
625
-
626
- assert_equal(1, method.callees.length)
627
- call_info = method.callees[0]
628
- assert_equal('Class#new', call_info.target.full_name)
629
- assert_equal(400.0, call_info.total_time)
630
- assert_equal(0.0, call_info.wait_time)
631
- assert_equal(400.0, call_info.self_time)
632
- assert_equal(0.0, call_info.children_time)
604
+ assert_equal(1, method.call_trees.callers.length)
605
+ call_tree = method.call_trees.callers[0]
606
+ assert_equal('Allocator#make_arrays', call_tree.parent.target.full_name)
607
+ assert_equal(400.0, call_tree.total_time)
608
+ assert_equal(0.0, call_tree.wait_time)
609
+ assert_equal(0.0, call_tree.self_time)
610
+ assert_equal(400.0, call_tree.children_time)
611
+
612
+ assert_equal(1, method.call_trees.callees.length)
613
+ call_tree = method.call_trees.callees[0]
614
+ assert_equal('Class#new', call_tree.target.full_name)
615
+ assert_equal(400.0, call_tree.total_time)
616
+ assert_equal(0.0, call_tree.wait_time)
617
+ assert_equal(400.0, call_tree.self_time)
618
+ assert_equal(0.0, call_tree.children_time)
619
+
620
+ # Method 7
621
+ method = methods[7]
622
+ assert_equal('Allocator#make_strings', method.full_name)
623
+ assert_equal(160.0, method.total_time)
624
+ assert_equal(0.0, method.wait_time)
625
+ assert_equal(40.0, method.self_time)
626
+ assert_equal(120.0, method.children_time)
627
+
628
+ assert_equal(1, method.call_trees.callers.length)
629
+ call_tree = method.call_trees.callers[0]
630
+ assert_equal('Allocator#internal_run', call_tree.parent.target.full_name)
631
+ assert_equal(160.0, call_tree.total_time)
632
+ assert_equal(0.0, call_tree.wait_time)
633
+ assert_equal(40.0, call_tree.self_time)
634
+ assert_equal(120.0, call_tree.children_time)
635
+
636
+ assert_equal(2, method.call_trees.callees.length)
637
+ call_tree = method.call_trees.callees[0]
638
+ assert_equal('String#*', call_tree.target.full_name)
639
+ assert_equal(40.0, call_tree.total_time)
640
+ assert_equal(0.0, call_tree.wait_time)
641
+ assert_equal(40.0, call_tree.self_time)
642
+ assert_equal(0.0, call_tree.children_time)
643
+
644
+ call_tree = method.call_trees.callees[1]
645
+ assert_equal('Class#new', call_tree.target.full_name)
646
+ assert_equal(80.0, call_tree.total_time)
647
+ assert_equal(0.0, call_tree.wait_time)
648
+ assert_equal(40.0, call_tree.self_time)
649
+ assert_equal(40.0, call_tree.children_time)
650
+
651
+ # Method 8
652
+ method = methods[8]
653
+ assert_equal('String#*', method.full_name)
654
+ assert_equal(40.0, method.total_time)
655
+ assert_equal(0.0, method.wait_time)
656
+ assert_equal(40.0, method.self_time)
657
+ assert_equal(0.0, method.children_time)
658
+
659
+ assert_equal(1, method.call_trees.callers.length)
660
+ call_tree = method.call_trees.callers[0]
661
+ assert_equal('Allocator#make_strings', call_tree.parent.target.full_name)
662
+ assert_equal(40.0, call_tree.total_time)
663
+ assert_equal(0.0, call_tree.wait_time)
664
+ assert_equal(40.0, call_tree.self_time)
665
+ assert_equal(0.0, call_tree.children_time)
666
+
667
+ assert_equal(0.0, method.call_trees.callees.length)
668
+
669
+ # Method 9
670
+ method = methods[9]
671
+ assert_equal('String#initialize', method.full_name)
672
+ assert_equal(40.0, method.total_time)
673
+ assert_equal(0.0, method.wait_time)
674
+ assert_equal(40.0, method.self_time)
675
+ assert_equal(0.0, method.children_time)
676
+
677
+ assert_equal(1, method.call_trees.callers.length)
678
+ call_tree = method.call_trees.callers[0]
679
+ assert_equal('Class#new', call_tree.parent.target.full_name)
680
+ assert_equal(40.0, call_tree.total_time)
681
+ assert_equal(0.0, call_tree.wait_time)
682
+ assert_equal(40.0, call_tree.self_time)
683
+ assert_equal(0.0, call_tree.children_time)
684
+
685
+ assert_equal(0.0, method.call_trees.callees.length)
686
+
687
+ # Method 10
688
+ method = methods[10]
689
+ assert_equal('BasicObject#initialize', method.full_name)
690
+ assert_equal(0.0, method.total_time)
691
+ assert_equal(0.0, method.wait_time)
692
+ assert_equal(0.0, method.self_time)
693
+ assert_equal(0.0, method.children_time)
694
+
695
+ assert_equal(1, method.call_trees.callers.length)
696
+ call_tree = method.call_trees.callers[0]
697
+ assert_equal('Class#new', call_tree.parent.target.full_name)
698
+ assert_equal(0.0, call_tree.total_time)
699
+ assert_equal(0.0, call_tree.wait_time)
700
+ assert_equal(0.0, call_tree.self_time)
701
+ assert_equal(0.0, call_tree.children_time)
702
+
703
+ assert_equal(0.0, method.call_trees.callees.length)
704
+
705
+ # Method 11
706
+ method = methods[11]
707
+ assert_equal('Hash#initialize', method.full_name)
708
+ assert_equal(0.0, method.total_time)
709
+ assert_equal(0.0, method.wait_time)
710
+ assert_equal(0.0, method.self_time)
711
+ assert_equal(0.0, method.children_time)
712
+
713
+ assert_equal(1, method.call_trees.callers.length)
714
+ call_tree = method.call_trees.callers[0]
715
+ assert_equal('Class#new', call_tree.parent.target.full_name)
716
+ assert_equal(0.0, call_tree.total_time)
717
+ assert_equal(0.0, call_tree.wait_time)
718
+ assert_equal(0.0, call_tree.self_time)
719
+ assert_equal(0.0, call_tree.children_time)
720
+
721
+ assert_equal(0.0, method.call_trees.callees.length)
722
+
723
+ # Method 12
724
+ method = methods[12]
725
+ assert_equal('Array#initialize', method.full_name)
726
+ assert_equal(0.0, method.total_time)
727
+ assert_equal(0.0, method.wait_time)
728
+ assert_equal(0.0, method.self_time)
729
+ assert_equal(0.0, method.children_time)
730
+
731
+ assert_equal(1, method.call_trees.callers.length)
732
+ call_tree = method.call_trees.callers[0]
733
+ assert_equal('Class#new', call_tree.parent.target.full_name)
734
+ assert_equal(0.0, call_tree.total_time)
735
+ assert_equal(0.0, call_tree.wait_time)
736
+ assert_equal(0.0, call_tree.self_time)
737
+ assert_equal(0.0, call_tree.children_time)
738
+
739
+ assert_equal(0.0, method.call_trees.callees.length)
740
+ end
741
+ else
742
+ def test_memory
743
+ result = RubyProf.profile do
744
+ allocator = Allocator.new
745
+ allocator.run
746
+ end
747
+
748
+ thread = result.threads.first
749
+
750
+ assert_in_delta(800, thread.total_time, 1)
751
+ methods = result.threads.first.methods.sort.reverse
752
+ assert_equal(13, methods.length)
753
+
754
+ # Method 0
755
+ method = methods[0]
756
+ assert_equal('MeasureMemoryTraceTest#test_memory', method.full_name)
757
+ assert_in_delta(800, method.total_time, 1)
758
+
759
+ assert_equal(0.0, method.wait_time)
760
+ assert_equal(0.0, method.self_time)
761
+ assert_in_delta(800, method.children_time, 1)
762
+ assert_equal(0, method.call_trees.callers.length)
763
+
764
+ assert_equal(2, method.call_trees.callees.length)
765
+ call_tree = method.call_trees.callees[0]
766
+ assert_equal('Class#new', call_tree.target.full_name)
767
+ assert_equal(40.0, call_tree.total_time)
768
+ assert_equal(0.0, call_tree.wait_time)
769
+ assert_equal(40.0, call_tree.self_time)
770
+ assert_equal(0.0, call_tree.children_time)
771
+
772
+ call_tree = method.call_trees.callees[1]
773
+ assert_equal('Allocator#run', call_tree.target.full_name)
774
+ assert_equal(760.0, call_tree.total_time)
775
+ assert_equal(0.0, call_tree.wait_time)
776
+ assert_equal(0.0, call_tree.self_time)
777
+ assert_equal(760.0, call_tree.children_time)
778
+
779
+ # Method 1
780
+ method = methods[1]
781
+ assert_equal('Allocator#run',method.full_name)
782
+ assert_equal(760.0, method.total_time)
783
+ assert_equal(0.0, method.wait_time)
784
+ assert_equal(0.0, method.self_time)
785
+ assert_equal(760.0, method.children_time)
786
+
787
+ assert_equal(1, method.call_trees.callers.length)
788
+ call_tree = method.call_trees.callers[0]
789
+ assert_equal('MeasureMemoryTraceTest#test_memory', call_tree.parent.target.full_name)
790
+ assert_equal(760.0, call_tree.total_time)
791
+ assert_equal(0.0, call_tree.wait_time)
792
+ assert_equal(0.0, call_tree.self_time)
793
+ assert_equal(760.0, call_tree.children_time)
794
+
795
+ assert_equal(1, method.call_trees.callees.length)
796
+ call_tree = method.call_trees.callees[0]
797
+ assert_equal('Allocator#internal_run', call_tree.target.full_name)
798
+ assert_equal(760.0, call_tree.total_time)
799
+ assert_equal(0.0, call_tree.wait_time)
800
+ assert_equal(0.0, call_tree.self_time)
801
+ assert_equal(760.0, call_tree.children_time)
802
+
803
+ # Method 2
804
+ method = methods[2]
805
+ assert_equal('Allocator#internal_run', method.full_name)
806
+ assert_equal(760.0, method.total_time)
807
+ assert_equal(0.0, method.wait_time)
808
+ assert_equal(0.0, method.self_time)
809
+ assert_equal(760.0, method.children_time)
810
+
811
+ assert_equal(1, method.call_trees.callers.length)
812
+ call_tree = method.call_trees.callers[0]
813
+ assert_equal('Allocator#run', call_tree.parent.target.full_name)
814
+ assert_equal(760.0, call_tree.total_time)
815
+ assert_equal(0.0, call_tree.wait_time)
816
+ assert_equal(0.0, call_tree.self_time)
817
+ assert_equal(760.0, call_tree.children_time)
818
+
819
+ assert_equal(3, method.call_trees.callees.length)
820
+ call_tree = method.call_trees.callees[0]
821
+ assert_equal('Allocator#make_arrays', call_tree.target.full_name)
822
+ assert_equal(400.0, call_tree.total_time)
823
+ assert_equal(0.0, call_tree.wait_time)
824
+ assert_equal(0.0, call_tree.self_time)
825
+ assert_equal(400.0, call_tree.children_time)
826
+
827
+ call_tree = method.call_trees.callees[1]
828
+ assert_equal('Allocator#make_hashes', call_tree.target.full_name)
829
+ assert_equal(200.0, call_tree.total_time)
830
+ assert_equal(0.0, call_tree.wait_time)
831
+ assert_equal(0.0, call_tree.self_time)
832
+ assert_equal(200.0, call_tree.children_time)
833
+
834
+ call_tree = method.call_trees.callees[2]
835
+ assert_equal('Allocator#make_strings', call_tree.target.full_name)
836
+ assert_equal(160.0, call_tree.total_time)
837
+ assert_equal(0.0, call_tree.wait_time)
838
+ assert_equal(40, call_tree.self_time)
839
+ assert_equal(120.0, call_tree.children_time)
840
+
841
+ # Method 3
842
+ method = methods[3]
843
+ assert_equal('Class#new', method.full_name)
844
+ assert_equal(720.0, method.total_time)
845
+ assert_equal(0.0, method.wait_time)
846
+ assert_equal(680.0, method.self_time)
847
+ assert_equal(40.0, method.children_time)
848
+
849
+ assert_equal(4, method.call_trees.callers.length)
850
+ call_tree = method.call_trees.callers[0]
851
+ assert_equal('MeasureMemoryTraceTest#test_memory', call_tree.parent.target.full_name)
852
+ assert_equal(40.0, call_tree.total_time)
853
+ assert_equal(0.0, call_tree.wait_time)
854
+ assert_equal(40.0, call_tree.self_time)
855
+ assert_equal(0.0, call_tree.children_time)
856
+
857
+ call_tree = method.call_trees.callers[1]
858
+ assert_equal('Integer#times', call_tree.parent.target.full_name)
859
+ assert_equal(400.0, call_tree.total_time)
860
+ assert_equal(0.0, call_tree.wait_time)
861
+ assert_equal(400.0, call_tree.self_time)
862
+ assert_equal(0.0, call_tree.children_time)
863
+
864
+ call_tree = method.call_trees.callers[2]
865
+ assert_equal('Allocator#make_hashes', call_tree.parent.target.full_name)
866
+ assert_equal(200.0, call_tree.total_time)
867
+ assert_equal(0.0, call_tree.wait_time)
868
+ assert_equal(200.0, call_tree.self_time)
869
+ assert_equal(0.0, call_tree.children_time)
870
+
871
+ call_tree = method.call_trees.callers[3]
872
+ assert_equal('Allocator#make_strings', call_tree.parent.target.full_name)
873
+ assert_equal(80.0, call_tree.total_time)
874
+ assert_equal(0.0, call_tree.wait_time)
875
+ assert_equal(40.0, call_tree.self_time)
876
+ assert_equal(40.0, call_tree.children_time)
877
+
878
+ assert_equal(4, method.call_trees.callees.length)
879
+ call_tree = method.call_trees.callees[0]
880
+ assert_equal('BasicObject#initialize', call_tree.target.full_name)
881
+ assert_equal(0.0, call_tree.total_time)
882
+ assert_equal(0.0, call_tree.wait_time)
883
+ assert_equal(0.0, call_tree.self_time)
884
+ assert_equal(0.0, call_tree.children_time)
885
+
886
+ call_tree = method.call_trees.callees[1]
887
+ assert_equal('Array#initialize', call_tree.target.full_name)
888
+ assert_equal(0.0, call_tree.total_time)
889
+ assert_equal(0.0, call_tree.wait_time)
890
+ assert_equal(0.0, call_tree.self_time)
891
+ assert_equal(0.0, call_tree.children_time)
892
+
893
+ call_tree = method.call_trees.callees[2]
894
+ assert_equal('Hash#initialize', call_tree.target.full_name)
895
+ assert_equal(0.0, call_tree.total_time)
896
+ assert_equal(0.0, call_tree.wait_time)
897
+ assert_equal(0.0, call_tree.self_time)
898
+ assert_equal(0.0, call_tree.children_time)
899
+
900
+ call_tree = method.call_trees.callees[3]
901
+ assert_equal('String#initialize', call_tree.target.full_name)
902
+ assert_equal(40.0, call_tree.total_time)
903
+ assert_equal(0.0, call_tree.wait_time)
904
+ assert_equal(40.0, call_tree.self_time)
905
+ assert_equal(0.0, call_tree.children_time)
906
+
907
+ # Method 4
908
+ method = methods[4]
909
+ assert_equal('Allocator#make_arrays', method.full_name)
910
+ assert_equal(400.0, method.total_time)
911
+ assert_equal(0.0, method.wait_time)
912
+ assert_equal(0.0, method.self_time)
913
+ assert_equal(400.0, method.children_time)
914
+
915
+ assert_equal(1, method.call_trees.callers.length)
916
+ call_tree = method.call_trees.callers[0]
917
+ assert_equal('Allocator#internal_run', call_tree.parent.target.full_name)
918
+ assert_equal(400.0, call_tree.total_time)
919
+ assert_equal(0.0, call_tree.wait_time)
920
+ assert_equal(0.0, call_tree.self_time)
921
+ assert_equal(400.0, call_tree.children_time)
922
+
923
+ assert_equal(1, method.call_trees.callees.length)
924
+ call_tree = method.call_trees.callees[0]
925
+ assert_equal('Integer#times', call_tree.target.full_name)
926
+ assert_equal(400.0, call_tree.total_time)
927
+ assert_equal(0.0, call_tree.wait_time)
928
+ assert_equal(0.0, call_tree.self_time)
929
+ assert_equal(400.0, call_tree.children_time)
930
+
931
+ # Method 5
932
+ method = methods[5]
933
+ assert_equal('Integer#times', method.full_name)
934
+ assert_equal(400.0, method.total_time)
935
+ assert_equal(0.0, method.wait_time)
936
+ assert_equal(0.0, method.self_time)
937
+ assert_equal(400.0, method.children_time)
938
+
939
+ assert_equal(1, method.call_trees.callers.length)
940
+ call_tree = method.call_trees.callers[0]
941
+ assert_equal('Allocator#make_arrays', call_tree.parent.target.full_name)
942
+ assert_equal(400.0, call_tree.total_time)
943
+ assert_equal(0.0, call_tree.wait_time)
944
+ assert_equal(0.0, call_tree.self_time)
945
+ assert_equal(400.0, call_tree.children_time)
946
+
947
+ assert_equal(1, method.call_trees.callees.length)
948
+ call_tree = method.call_trees.callees[0]
949
+ assert_equal('Class#new', call_tree.target.full_name)
950
+ assert_equal(400.0, call_tree.total_time)
951
+ assert_equal(0.0, call_tree.wait_time)
952
+ assert_equal(400.0, call_tree.self_time)
953
+ assert_equal(0.0, call_tree.children_time)
954
+
955
+ # Method 6
956
+ method = methods[6]
957
+ assert_equal('Allocator#make_hashes', method.full_name)
958
+ assert_equal(200.0, method.total_time)
959
+ assert_equal(0.0, method.wait_time)
960
+ assert_equal(0.0, method.self_time)
961
+ assert_equal(200.0, method.children_time)
962
+
963
+ assert_equal(1, method.call_trees.callers.length)
964
+ call_tree = method.call_trees.callers[0]
965
+ assert_equal('Allocator#internal_run', call_tree.parent.target.full_name)
966
+ assert_equal(200.0, call_tree.total_time)
967
+ assert_equal(0.0, call_tree.wait_time)
968
+ assert_equal(0.0, call_tree.self_time)
969
+ assert_equal(200.0, call_tree.children_time)
970
+
971
+ assert_equal(1, method.call_trees.callees.length)
972
+ call_tree = method.call_trees.callees[0]
973
+ assert_equal('Class#new', call_tree.target.full_name)
974
+ assert_equal(200.0, call_tree.total_time)
975
+ assert_equal(0.0, call_tree.wait_time)
976
+ assert_equal(200.0, call_tree.self_time)
977
+ assert_equal(0.0, call_tree.children_time)
633
978
 
634
979
  # Method 7
635
980
  method = methods[7]
@@ -639,28 +984,28 @@ class MeasureMemoryTraceTest < TestCase
639
984
  assert_equal(40.0, method.self_time)
640
985
  assert_equal(120.0, method.children_time)
641
986
 
642
- assert_equal(1, method.callers.length)
643
- call_info = method.callers[0]
644
- assert_equal('Allocator#internal_run', call_info.parent.full_name)
645
- assert_equal(160.0, call_info.total_time)
646
- assert_equal(0.0, call_info.wait_time)
647
- assert_equal(40.0, call_info.self_time)
648
- assert_equal(120.0, call_info.children_time)
649
-
650
- assert_equal(2, method.callees.length)
651
- call_info = method.callees[0]
652
- assert_equal('String#*', call_info.target.full_name)
653
- assert_equal(40.0, call_info.total_time)
654
- assert_equal(0.0, call_info.wait_time)
655
- assert_equal(40.0, call_info.self_time)
656
- assert_equal(0.0, call_info.children_time)
657
-
658
- call_info = method.callees[1]
659
- assert_equal('Class#new', call_info.target.full_name)
660
- assert_equal(80.0, call_info.total_time)
661
- assert_equal(0.0, call_info.wait_time)
662
- assert_equal(40.0, call_info.self_time)
663
- assert_equal(40.0, call_info.children_time)
987
+ assert_equal(1, method.call_trees.callers.length)
988
+ call_tree = method.call_trees.callers[0]
989
+ assert_equal('Allocator#internal_run', call_tree.parent.target.full_name)
990
+ assert_equal(160.0, call_tree.total_time)
991
+ assert_equal(0.0, call_tree.wait_time)
992
+ assert_equal(40.0, call_tree.self_time)
993
+ assert_equal(120.0, call_tree.children_time)
994
+
995
+ assert_equal(2, method.call_trees.callees.length)
996
+ call_tree = method.call_trees.callees[0]
997
+ assert_equal('String#*', call_tree.target.full_name)
998
+ assert_equal(40.0, call_tree.total_time)
999
+ assert_equal(0.0, call_tree.wait_time)
1000
+ assert_equal(40.0, call_tree.self_time)
1001
+ assert_equal(0.0, call_tree.children_time)
1002
+
1003
+ call_tree = method.call_trees.callees[1]
1004
+ assert_equal('Class#new', call_tree.target.full_name)
1005
+ assert_equal(80.0, call_tree.total_time)
1006
+ assert_equal(0.0, call_tree.wait_time)
1007
+ assert_equal(40.0, call_tree.self_time)
1008
+ assert_equal(40.0, call_tree.children_time)
664
1009
 
665
1010
  # Method 8
666
1011
  method = methods[8]
@@ -670,15 +1015,15 @@ class MeasureMemoryTraceTest < TestCase
670
1015
  assert_equal(40.0, method.self_time)
671
1016
  assert_equal(0.0, method.children_time)
672
1017
 
673
- assert_equal(1, method.callers.length)
674
- call_info = method.callers[0]
675
- assert_equal('Allocator#make_strings', call_info.parent.full_name)
676
- assert_equal(40.0, call_info.total_time)
677
- assert_equal(0.0, call_info.wait_time)
678
- assert_equal(40.0, call_info.self_time)
679
- assert_equal(0.0, call_info.children_time)
1018
+ assert_equal(1, method.call_trees.callers.length)
1019
+ call_tree = method.call_trees.callers[0]
1020
+ assert_equal('Allocator#make_strings', call_tree.parent.target.full_name)
1021
+ assert_equal(40.0, call_tree.total_time)
1022
+ assert_equal(0.0, call_tree.wait_time)
1023
+ assert_equal(40.0, call_tree.self_time)
1024
+ assert_equal(0.0, call_tree.children_time)
680
1025
 
681
- assert_equal(0.0, method.callees.length)
1026
+ assert_equal(0.0, method.call_trees.callees.length)
682
1027
 
683
1028
  # Method 9
684
1029
  method = methods[9]
@@ -688,15 +1033,15 @@ class MeasureMemoryTraceTest < TestCase
688
1033
  assert_equal(40.0, method.self_time)
689
1034
  assert_equal(0.0, method.children_time)
690
1035
 
691
- assert_equal(1, method.callers.length)
692
- call_info = method.callers[0]
693
- assert_equal('Class#new', call_info.parent.full_name)
694
- assert_equal(40.0, call_info.total_time)
695
- assert_equal(0.0, call_info.wait_time)
696
- assert_equal(40.0, call_info.self_time)
697
- assert_equal(0.0, call_info.children_time)
1036
+ assert_equal(1, method.call_trees.callers.length)
1037
+ call_tree = method.call_trees.callers[0]
1038
+ assert_equal('Class#new', call_tree.parent.target.full_name)
1039
+ assert_equal(40.0, call_tree.total_time)
1040
+ assert_equal(0.0, call_tree.wait_time)
1041
+ assert_equal(40.0, call_tree.self_time)
1042
+ assert_equal(0.0, call_tree.children_time)
698
1043
 
699
- assert_equal(0.0, method.callees.length)
1044
+ assert_equal(0.0, method.call_trees.callees.length)
700
1045
 
701
1046
  # Method 10
702
1047
  method = methods[10]
@@ -706,15 +1051,15 @@ class MeasureMemoryTraceTest < TestCase
706
1051
  assert_equal(0.0, method.self_time)
707
1052
  assert_equal(0.0, method.children_time)
708
1053
 
709
- assert_equal(1, method.callers.length)
710
- call_info = method.callers[0]
711
- assert_equal('Class#new', call_info.parent.full_name)
712
- assert_equal(0.0, call_info.total_time)
713
- assert_equal(0.0, call_info.wait_time)
714
- assert_equal(0.0, call_info.self_time)
715
- assert_equal(0.0, call_info.children_time)
1054
+ assert_equal(1, method.call_trees.callers.length)
1055
+ call_tree = method.call_trees.callers[0]
1056
+ assert_equal('Class#new', call_tree.parent.target.full_name)
1057
+ assert_equal(0.0, call_tree.total_time)
1058
+ assert_equal(0.0, call_tree.wait_time)
1059
+ assert_equal(0.0, call_tree.self_time)
1060
+ assert_equal(0.0, call_tree.children_time)
716
1061
 
717
- assert_equal(0.0, method.callees.length)
1062
+ assert_equal(0.0, method.call_trees.callees.length)
718
1063
 
719
1064
  # Method 11
720
1065
  method = methods[11]
@@ -724,15 +1069,15 @@ class MeasureMemoryTraceTest < TestCase
724
1069
  assert_equal(0.0, method.self_time)
725
1070
  assert_equal(0.0, method.children_time)
726
1071
 
727
- assert_equal(1, method.callers.length)
728
- call_info = method.callers[0]
729
- assert_equal('Class#new', call_info.parent.full_name)
730
- assert_equal(0.0, call_info.total_time)
731
- assert_equal(0.0, call_info.wait_time)
732
- assert_equal(0.0, call_info.self_time)
733
- assert_equal(0.0, call_info.children_time)
1072
+ assert_equal(1, method.call_trees.callers.length)
1073
+ call_tree = method.call_trees.callers[0]
1074
+ assert_equal('Class#new', call_tree.parent.target.full_name)
1075
+ assert_equal(0.0, call_tree.total_time)
1076
+ assert_equal(0.0, call_tree.wait_time)
1077
+ assert_equal(0.0, call_tree.self_time)
1078
+ assert_equal(0.0, call_tree.children_time)
734
1079
 
735
- assert_equal(0.0, method.callees.length)
1080
+ assert_equal(0.0, method.call_trees.callees.length)
736
1081
 
737
1082
  # Method 12
738
1083
  method = methods[12]
@@ -742,15 +1087,15 @@ class MeasureMemoryTraceTest < TestCase
742
1087
  assert_equal(0.0, method.self_time)
743
1088
  assert_equal(0.0, method.children_time)
744
1089
 
745
- assert_equal(1, method.callers.length)
746
- call_info = method.callers[0]
747
- assert_equal('Class#new', call_info.parent.full_name)
748
- assert_equal(0.0, call_info.total_time)
749
- assert_equal(0.0, call_info.wait_time)
750
- assert_equal(0.0, call_info.self_time)
751
- assert_equal(0.0, call_info.children_time)
1090
+ assert_equal(1, method.call_trees.callers.length)
1091
+ call_tree = method.call_trees.callers[0]
1092
+ assert_equal('Class#new', call_tree.parent.target.full_name)
1093
+ assert_equal(0.0, call_tree.total_time)
1094
+ assert_equal(0.0, call_tree.wait_time)
1095
+ assert_equal(0.0, call_tree.self_time)
1096
+ assert_equal(0.0, call_tree.children_time)
752
1097
 
753
- assert_equal(0.0, method.callees.length)
1098
+ assert_equal(0.0, method.call_trees.callees.length)
754
1099
  end
755
1100
  end
756
1101
  end