ruby-prof 1.6.3-x64-mingw-ucrt → 1.7.0-x64-mingw-ucrt

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES +7 -0
  3. data/ext/ruby_prof/rp_allocation.c +342 -342
  4. data/ext/ruby_prof/rp_call_tree.c +1 -1
  5. data/ext/ruby_prof/rp_call_tree.h +1 -1
  6. data/ext/ruby_prof/rp_call_trees.c +2 -2
  7. data/ext/ruby_prof/rp_call_trees.h +2 -2
  8. data/ext/ruby_prof/rp_measure_allocations.c +1 -1
  9. data/ext/ruby_prof/rp_measure_memory.c +46 -46
  10. data/ext/ruby_prof/rp_measure_process_time.c +1 -1
  11. data/ext/ruby_prof/rp_measure_wall_time.c +1 -1
  12. data/ext/ruby_prof/rp_measurement.c +364 -364
  13. data/ext/ruby_prof/rp_method.c +24 -12
  14. data/ext/ruby_prof/rp_method.h +5 -2
  15. data/ext/ruby_prof/rp_profile.c +2 -2
  16. data/ext/ruby_prof/rp_profile.h +36 -36
  17. data/ext/ruby_prof/rp_stack.c +1 -1
  18. data/ext/ruby_prof/rp_thread.c +1 -1
  19. data/ext/ruby_prof/ruby_prof.c +1 -1
  20. data/ext/ruby_prof/ruby_prof.h +34 -34
  21. data/ext/ruby_prof/vc/ruby_prof.vcxproj +5 -7
  22. data/lib/3.2/ruby_prof.so +0 -0
  23. data/lib/3.3/ruby_prof.so +0 -0
  24. data/lib/ruby-prof/compatibility.rb +10 -10
  25. data/lib/ruby-prof/exclude_common_methods.rb +9 -3
  26. data/lib/ruby-prof/method_info.rb +87 -85
  27. data/lib/ruby-prof/version.rb +1 -1
  28. data/ruby-prof.gemspec +1 -1
  29. data/test/crash2.rb +144 -0
  30. data/test/enumerable_test.rb +5 -5
  31. data/test/exclude_methods_test.rb +197 -86
  32. data/test/line_number_test.rb +254 -99
  33. data/test/measure_allocations_test.rb +422 -1
  34. data/test/measure_memory_test.rb +433 -1
  35. data/test/measure_process_time_test.rb +882 -15
  36. data/test/measure_wall_time_test.rb +195 -47
  37. data/test/method_info_test.rb +1 -1
  38. data/test/recursive_test.rb +198 -1
  39. data/test/thread_test.rb +0 -4
  40. metadata +7 -6
  41. data/lib/3.1/ruby_prof.so +0 -0
@@ -28,107 +28,262 @@ end
28
28
 
29
29
  # -- Tests ----
30
30
  class LineNumbersTest < TestCase
31
- def test_function_line_no
32
- numbers = LineNumbers.new
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
- result = RubyProf::Profile.profile do
35
- numbers.method_1
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
- # Sort methods by name to have stable results
39
- methods = result.threads.first.methods.sort_by(&:full_name)
40
- assert_equal(6, methods.length)
41
-
42
- # Method 0
43
- method = methods[0]
44
- assert_equal('Integer#times', method.full_name)
45
- assert_equal(0, method.line)
46
-
47
- assert_equal(1, method.call_trees.callers.count)
48
- call_tree = method.call_trees.callers[0]
49
- assert_equal('LineNumbers#method_2', call_tree.parent.target.full_name)
50
- assert_equal(15, call_tree.line)
51
-
52
- assert_equal(1, method.call_trees.callees.count)
53
- call_tree = method.call_trees.callees[0]
54
- assert_equal('LineNumbers#method_3', call_tree.target.full_name)
55
- assert_equal(17, call_tree.line)
56
-
57
- # Method 1
58
- method = methods[1]
59
- assert_equal('LineNumbers#method_1', method.full_name)
60
- assert_equal(7, method.line)
61
-
62
- assert_equal(1, method.call_trees.callers.count)
63
- call_tree = method.call_trees.callers[0]
64
- assert_equal('LineNumbersTest#test_function_line_no', call_tree.parent.target.full_name)
65
- assert_equal(35, call_tree.line)
66
-
67
- assert_equal(2, method.call_trees.callees.count)
68
- call_tree = method.call_trees.callees[0]
69
- assert_equal('LineNumbers#method_2', call_tree.target.full_name)
70
- assert_equal(8, call_tree.line)
71
-
72
- call_tree = method.call_trees.callees[1]
73
- assert_equal('LineNumbers#method_3', call_tree.target.full_name)
74
- assert_equal(10, call_tree.line)
75
-
76
- # Method 2
77
- method = methods[2]
78
- assert_equal('LineNumbers#method_2', method.full_name)
79
- assert_equal(13, method.line)
80
-
81
- assert_equal(1, method.call_trees.callers.count)
82
- call_tree = method.call_trees.callers[0]
83
- assert_equal('LineNumbers#method_1', call_tree.parent.target.full_name)
84
- assert_equal(8, call_tree.line)
85
-
86
- assert_equal(1, method.call_trees.callees.count)
87
- call_tree = method.call_trees.callees[0]
88
- assert_equal('Integer#times', call_tree.target.full_name)
89
- assert_equal(15, call_tree.line)
90
-
91
- # Method 3
92
- method = methods[3]
93
- assert_equal('LineNumbers#method_3', method.full_name)
94
- assert_equal(21, method.line)
95
-
96
- assert_equal(2, method.call_trees.callers.count)
97
- call_tree = method.call_trees.callers[0]
98
- assert_equal('Integer#times', call_tree.parent.target.full_name)
99
- assert_equal(17, call_tree.line)
100
-
101
- call_tree = method.call_trees.callers[1]
102
- assert_equal('LineNumbers#method_1', call_tree.parent.target.full_name)
103
- assert_equal(10, call_tree.line)
104
-
105
- assert_equal(1, method.call_trees.callees.count)
106
- call_tree = method.call_trees.callees[0]
107
- assert_equal('LineNumbers#method_4', call_tree.target.full_name)
108
- assert_equal(22, call_tree.line)
109
-
110
- # Method 4
111
- method = methods[4]
112
- assert_equal('LineNumbers#method_4', method.full_name)
113
- assert_equal(25, method.line)
114
-
115
- assert_equal(1, method.call_trees.callers.count)
116
- call_tree = method.call_trees.callers[0]
117
- assert_equal('LineNumbers#method_3', call_tree.parent.target.full_name)
118
- assert_equal(22, call_tree.line)
119
-
120
- assert_equal(0, method.call_trees.callees.count)
121
-
122
- # Method 5
123
- method = methods[5]
124
- assert_equal('LineNumbersTest#test_function_line_no', method.full_name)
125
- assert_equal(35, method.line)
126
-
127
- assert_equal(0, method.call_trees.callers.count)
128
-
129
- assert_equal(1, method.call_trees.callees.count)
130
- call_tree = method.call_trees.callees[0]
131
- assert_equal('LineNumbers#method_1', call_tree.target.full_name)
132
- assert_equal(35, call_tree.line)
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