ruby-prof 1.6.3-x64-mingw-ucrt → 1.7.1-x64-mingw-ucrt
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES +11 -0
- data/ext/ruby_prof/rp_allocation.c +342 -342
- data/ext/ruby_prof/rp_call_tree.c +1 -1
- data/ext/ruby_prof/rp_call_tree.h +1 -1
- data/ext/ruby_prof/rp_call_trees.c +2 -2
- data/ext/ruby_prof/rp_call_trees.h +2 -2
- data/ext/ruby_prof/rp_measure_allocations.c +1 -1
- data/ext/ruby_prof/rp_measure_memory.c +46 -46
- data/ext/ruby_prof/rp_measure_process_time.c +1 -1
- data/ext/ruby_prof/rp_measure_wall_time.c +1 -1
- data/ext/ruby_prof/rp_measurement.c +364 -364
- data/ext/ruby_prof/rp_method.c +26 -25
- data/ext/ruby_prof/rp_method.h +5 -2
- data/ext/ruby_prof/rp_profile.c +2 -2
- data/ext/ruby_prof/rp_profile.h +36 -36
- data/ext/ruby_prof/rp_stack.c +1 -1
- data/ext/ruby_prof/rp_thread.c +1 -1
- data/ext/ruby_prof/ruby_prof.c +1 -1
- data/ext/ruby_prof/ruby_prof.h +34 -34
- data/ext/ruby_prof/vc/ruby_prof.vcxproj +5 -7
- data/lib/3.3/ruby_prof.so +0 -0
- data/lib/ruby-prof/compatibility.rb +10 -10
- data/lib/ruby-prof/exclude_common_methods.rb +9 -3
- data/lib/ruby-prof/method_info.rb +87 -85
- data/lib/ruby-prof/version.rb +1 -1
- data/ruby-prof.gemspec +2 -1
- data/test/crash2.rb +144 -0
- data/test/enumerable_test.rb +5 -5
- data/test/exclude_methods_test.rb +197 -86
- data/test/line_number_test.rb +254 -99
- data/test/measure_allocations_test.rb +422 -1
- data/test/measure_memory_test.rb +433 -1
- data/test/measure_process_time_test.rb +882 -15
- data/test/measure_wall_time_test.rb +195 -47
- data/test/method_info_test.rb +1 -1
- data/test/recursive_test.rb +198 -1
- data/test/thread_test.rb +0 -4
- metadata +21 -7
- data/lib/3.1/ruby_prof.so +0 -0
- data/lib/3.2/ruby_prof.so +0 -0
data/test/line_number_test.rb
CHANGED
@@ -28,107 +28,262 @@ end
|
|
28
28
|
|
29
29
|
# -- Tests ----
|
30
30
|
class LineNumbersTest < TestCase
|
31
|
-
|
32
|
-
|
31
|
+
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('3.3')
|
32
|
+
def test_function_line_no
|
33
|
+
numbers = LineNumbers.new
|
33
34
|
|
34
|
-
|
35
|
-
|
35
|
+
result = RubyProf::Profile.profile do
|
36
|
+
numbers.method_1
|
37
|
+
end
|
38
|
+
|
39
|
+
# Sort methods by name to have stable results
|
40
|
+
methods = result.threads.first.methods.sort_by(&:full_name)
|
41
|
+
assert_equal(6, methods.length)
|
42
|
+
|
43
|
+
# Method 0
|
44
|
+
method = methods[0]
|
45
|
+
assert_equal('Integer#times', method.full_name)
|
46
|
+
assert_equal(0, method.line)
|
47
|
+
|
48
|
+
assert_equal(1, method.call_trees.callers.count)
|
49
|
+
call_tree = method.call_trees.callers[0]
|
50
|
+
assert_equal('LineNumbers#method_2', call_tree.parent.target.full_name)
|
51
|
+
assert_equal(15, call_tree.line)
|
52
|
+
|
53
|
+
assert_equal(1, method.call_trees.callees.count)
|
54
|
+
call_tree = method.call_trees.callees[0]
|
55
|
+
assert_equal('LineNumbers#method_3', call_tree.target.full_name)
|
56
|
+
assert_equal(17, call_tree.line)
|
57
|
+
|
58
|
+
# Method 1
|
59
|
+
method = methods[1]
|
60
|
+
assert_equal('LineNumbers#method_1', method.full_name)
|
61
|
+
assert_equal(7, method.line)
|
62
|
+
|
63
|
+
assert_equal(1, method.call_trees.callers.count)
|
64
|
+
call_tree = method.call_trees.callers[0]
|
65
|
+
assert_equal('LineNumbersTest#test_function_line_no', call_tree.parent.target.full_name)
|
66
|
+
assert_equal(36, call_tree.line)
|
67
|
+
|
68
|
+
assert_equal(2, method.call_trees.callees.count)
|
69
|
+
call_tree = method.call_trees.callees[0]
|
70
|
+
assert_equal('LineNumbers#method_2', call_tree.target.full_name)
|
71
|
+
assert_equal(8, call_tree.line)
|
72
|
+
|
73
|
+
call_tree = method.call_trees.callees[1]
|
74
|
+
assert_equal('LineNumbers#method_3', call_tree.target.full_name)
|
75
|
+
assert_equal(10, call_tree.line)
|
76
|
+
|
77
|
+
# Method 2
|
78
|
+
method = methods[2]
|
79
|
+
assert_equal('LineNumbers#method_2', method.full_name)
|
80
|
+
assert_equal(13, method.line)
|
81
|
+
|
82
|
+
assert_equal(1, method.call_trees.callers.count)
|
83
|
+
call_tree = method.call_trees.callers[0]
|
84
|
+
assert_equal('LineNumbers#method_1', call_tree.parent.target.full_name)
|
85
|
+
assert_equal(8, call_tree.line)
|
86
|
+
|
87
|
+
assert_equal(1, method.call_trees.callees.count)
|
88
|
+
call_tree = method.call_trees.callees[0]
|
89
|
+
assert_equal('Integer#times', call_tree.target.full_name)
|
90
|
+
assert_equal(15, call_tree.line)
|
91
|
+
|
92
|
+
# Method 3
|
93
|
+
method = methods[3]
|
94
|
+
assert_equal('LineNumbers#method_3', method.full_name)
|
95
|
+
assert_equal(21, method.line)
|
96
|
+
|
97
|
+
assert_equal(2, method.call_trees.callers.count)
|
98
|
+
call_tree = method.call_trees.callers[0]
|
99
|
+
assert_equal('Integer#times', call_tree.parent.target.full_name)
|
100
|
+
assert_equal(17, call_tree.line)
|
101
|
+
|
102
|
+
call_tree = method.call_trees.callers[1]
|
103
|
+
assert_equal('LineNumbers#method_1', call_tree.parent.target.full_name)
|
104
|
+
assert_equal(10, call_tree.line)
|
105
|
+
|
106
|
+
assert_equal(1, method.call_trees.callees.count)
|
107
|
+
call_tree = method.call_trees.callees[0]
|
108
|
+
assert_equal('LineNumbers#method_4', call_tree.target.full_name)
|
109
|
+
assert_equal(22, call_tree.line)
|
110
|
+
|
111
|
+
# Method 4
|
112
|
+
method = methods[4]
|
113
|
+
assert_equal('LineNumbers#method_4', method.full_name)
|
114
|
+
assert_equal(25, method.line)
|
115
|
+
|
116
|
+
assert_equal(1, method.call_trees.callers.count)
|
117
|
+
call_tree = method.call_trees.callers[0]
|
118
|
+
assert_equal('LineNumbers#method_3', call_tree.parent.target.full_name)
|
119
|
+
assert_equal(22, call_tree.line)
|
120
|
+
|
121
|
+
assert_equal(0, method.call_trees.callees.count)
|
122
|
+
|
123
|
+
# Method 5
|
124
|
+
method = methods[5]
|
125
|
+
assert_equal('LineNumbersTest#test_function_line_no', method.full_name)
|
126
|
+
assert_equal(36, method.line)
|
127
|
+
|
128
|
+
assert_equal(0, method.call_trees.callers.count)
|
129
|
+
|
130
|
+
assert_equal(1, method.call_trees.callees.count)
|
131
|
+
call_tree = method.call_trees.callees[0]
|
132
|
+
assert_equal('LineNumbers#method_1', call_tree.target.full_name)
|
133
|
+
assert_equal(36, call_tree.line)
|
36
134
|
end
|
135
|
+
else
|
136
|
+
def test_function_line_no
|
137
|
+
numbers = LineNumbers.new
|
138
|
+
|
139
|
+
result = RubyProf::Profile.profile do
|
140
|
+
numbers.method_1
|
141
|
+
end
|
142
|
+
|
143
|
+
# Sort methods by name to have stable results
|
144
|
+
methods = result.threads.first.methods.sort_by(&:full_name)
|
145
|
+
assert_equal(9, methods.length)
|
146
|
+
|
147
|
+
# Method 0
|
148
|
+
method = methods[0]
|
149
|
+
assert_equal('Integer#<', method.full_name)
|
150
|
+
assert_equal(0, method.line)
|
151
|
+
|
152
|
+
assert_equal(1, method.call_trees.callers.count)
|
153
|
+
call_tree = method.call_trees.callers[0]
|
154
|
+
assert_equal('Integer#times', call_tree.parent.target.full_name)
|
155
|
+
assert_equal(236, call_tree.line)
|
156
|
+
|
157
|
+
assert_equal(0, method.call_trees.callees.count)
|
158
|
+
|
159
|
+
# Method 1
|
160
|
+
method = methods[1]
|
161
|
+
assert_equal('Integer#succ', method.full_name)
|
162
|
+
assert_equal(0, method.line)
|
163
|
+
|
164
|
+
assert_equal(1, method.call_trees.callers.count)
|
165
|
+
call_tree = method.call_trees.callers[0]
|
166
|
+
assert_equal('Integer#times', call_tree.parent.target.full_name)
|
167
|
+
assert_equal(238, call_tree.line)
|
37
168
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
169
|
+
assert_equal(0, method.call_trees.callees.count)
|
170
|
+
|
171
|
+
# Method 2
|
172
|
+
method = methods[2]
|
173
|
+
assert_equal('Integer#times', method.full_name)
|
174
|
+
assert_equal(231, method.line)
|
175
|
+
|
176
|
+
assert_equal(1, method.call_trees.callers.count)
|
177
|
+
call_tree = method.call_trees.callers[0]
|
178
|
+
assert_equal('LineNumbers#method_2', call_tree.parent.target.full_name)
|
179
|
+
assert_equal(15, call_tree.line)
|
180
|
+
|
181
|
+
assert_equal(4, method.call_trees.callees.count)
|
182
|
+
|
183
|
+
call_tree = method.call_trees.callees[0]
|
184
|
+
assert_equal('Kernel#block_given?', call_tree.target.full_name)
|
185
|
+
assert_equal(232, call_tree.line)
|
186
|
+
|
187
|
+
call_tree = method.call_trees.callees[1]
|
188
|
+
assert_equal('Integer#<', call_tree.target.full_name)
|
189
|
+
assert_equal(236, call_tree.line)
|
190
|
+
|
191
|
+
call_tree = method.call_trees.callees[2]
|
192
|
+
assert_equal('LineNumbers#method_3', call_tree.target.full_name)
|
193
|
+
assert_equal(17, call_tree.line)
|
194
|
+
|
195
|
+
call_tree = method.call_trees.callees[3]
|
196
|
+
assert_equal('Integer#succ', call_tree.target.full_name)
|
197
|
+
assert_equal(238, call_tree.line)
|
198
|
+
|
199
|
+
# Method 3
|
200
|
+
method = methods[3]
|
201
|
+
assert_equal('Kernel#block_given?', method.full_name)
|
202
|
+
assert_equal(0, method.line)
|
203
|
+
|
204
|
+
assert_equal(1, method.call_trees.callers.count)
|
205
|
+
call_tree = method.call_trees.callers[0]
|
206
|
+
assert_equal('Integer#times', call_tree.parent.target.full_name)
|
207
|
+
assert_equal(232, call_tree.line)
|
208
|
+
|
209
|
+
assert_equal(0, method.call_trees.callees.count)
|
210
|
+
|
211
|
+
# Method 4
|
212
|
+
method = methods[4]
|
213
|
+
assert_equal('LineNumbers#method_1', method.full_name)
|
214
|
+
assert_equal(7, method.line)
|
215
|
+
|
216
|
+
assert_equal(1, method.call_trees.callers.count)
|
217
|
+
call_tree = method.call_trees.callers[0]
|
218
|
+
assert_equal('LineNumbersTest#test_function_line_no', call_tree.parent.target.full_name)
|
219
|
+
assert_equal(140, call_tree.line)
|
220
|
+
|
221
|
+
assert_equal(2, method.call_trees.callees.count)
|
222
|
+
call_tree = method.call_trees.callees[0]
|
223
|
+
assert_equal('LineNumbers#method_2', call_tree.target.full_name)
|
224
|
+
assert_equal(8, call_tree.line)
|
225
|
+
|
226
|
+
call_tree = method.call_trees.callees[1]
|
227
|
+
assert_equal('LineNumbers#method_3', call_tree.target.full_name)
|
228
|
+
assert_equal(10, call_tree.line)
|
229
|
+
|
230
|
+
# Method 5
|
231
|
+
method = methods[5]
|
232
|
+
assert_equal('LineNumbers#method_2', method.full_name)
|
233
|
+
assert_equal(13, method.line)
|
234
|
+
|
235
|
+
assert_equal(1, method.call_trees.callers.count)
|
236
|
+
call_tree = method.call_trees.callers[0]
|
237
|
+
assert_equal('LineNumbers#method_1', call_tree.parent.target.full_name)
|
238
|
+
assert_equal(8, call_tree.line)
|
239
|
+
|
240
|
+
assert_equal(1, method.call_trees.callees.count)
|
241
|
+
call_tree = method.call_trees.callees[0]
|
242
|
+
assert_equal('Integer#times', call_tree.target.full_name)
|
243
|
+
assert_equal(15, call_tree.line)
|
244
|
+
|
245
|
+
# Method 6
|
246
|
+
method = methods[6]
|
247
|
+
assert_equal('LineNumbers#method_3', method.full_name)
|
248
|
+
assert_equal(21, method.line)
|
249
|
+
|
250
|
+
assert_equal(2, method.call_trees.callers.count)
|
251
|
+
call_tree = method.call_trees.callers[0]
|
252
|
+
assert_equal('Integer#times', call_tree.parent.target.full_name)
|
253
|
+
assert_equal(17, call_tree.line)
|
254
|
+
|
255
|
+
call_tree = method.call_trees.callers[1]
|
256
|
+
assert_equal('LineNumbers#method_1', call_tree.parent.target.full_name)
|
257
|
+
assert_equal(10, call_tree.line)
|
258
|
+
|
259
|
+
assert_equal(1, method.call_trees.callees.count)
|
260
|
+
call_tree = method.call_trees.callees[0]
|
261
|
+
assert_equal('LineNumbers#method_4', call_tree.target.full_name)
|
262
|
+
assert_equal(22, call_tree.line)
|
263
|
+
|
264
|
+
# Method 7
|
265
|
+
method = methods[7]
|
266
|
+
assert_equal('LineNumbers#method_4', method.full_name)
|
267
|
+
assert_equal(25, method.line)
|
268
|
+
|
269
|
+
assert_equal(1, method.call_trees.callers.count)
|
270
|
+
call_tree = method.call_trees.callers[0]
|
271
|
+
assert_equal('LineNumbers#method_3', call_tree.parent.target.full_name)
|
272
|
+
assert_equal(22, call_tree.line)
|
273
|
+
|
274
|
+
assert_equal(0, method.call_trees.callees.count)
|
275
|
+
|
276
|
+
# Method 8
|
277
|
+
method = methods[8]
|
278
|
+
assert_equal('LineNumbersTest#test_function_line_no', method.full_name)
|
279
|
+
assert_equal(140, method.line)
|
280
|
+
|
281
|
+
assert_equal(0, method.call_trees.callers.count)
|
282
|
+
|
283
|
+
assert_equal(1, method.call_trees.callees.count)
|
284
|
+
call_tree = method.call_trees.callees[0]
|
285
|
+
assert_equal('LineNumbers#method_1', call_tree.target.full_name)
|
286
|
+
assert_equal(140, call_tree.line)
|
287
|
+
end
|
133
288
|
end
|
134
289
|
end
|