ruby-prof 1.7.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/{CHANGES → CHANGELOG.md} +112 -178
- data/README.md +5 -5
- data/bin/ruby-prof +1 -4
- data/docs/advanced-usage.md +132 -0
- data/docs/alternatives.md +98 -0
- data/docs/architecture.md +122 -0
- data/docs/best-practices.md +27 -0
- data/docs/getting-started.md +130 -0
- data/docs/history.md +11 -0
- data/docs/index.md +45 -0
- data/docs/profiling-rails.md +64 -0
- data/docs/public/examples/example.rb +33 -0
- data/docs/public/examples/generate_reports.rb +92 -0
- data/docs/public/examples/reports/call_info.txt +27 -0
- data/docs/public/examples/reports/call_stack.html +835 -0
- data/docs/public/examples/reports/callgrind.out +150 -0
- data/docs/public/examples/reports/flame_graph.html +408 -0
- data/docs/public/examples/reports/flat.txt +45 -0
- data/docs/public/examples/reports/graph.dot +129 -0
- data/docs/public/examples/reports/graph.html +1319 -0
- data/docs/public/examples/reports/graph.txt +100 -0
- data/docs/public/examples/reports/graphviz_viewer.html +1 -0
- data/docs/public/images/call_stack.png +0 -0
- data/docs/public/images/class_diagram.png +0 -0
- data/docs/public/images/dot_printer.png +0 -0
- data/docs/public/images/flame_graph.png +0 -0
- data/docs/public/images/flat.png +0 -0
- data/docs/public/images/graph.png +0 -0
- data/docs/public/images/graph_html.png +0 -0
- data/docs/public/images/ruby-prof-logo.svg +1 -0
- data/docs/reports.md +150 -0
- data/docs/stylesheets/extra.css +80 -0
- data/ext/ruby_prof/rp_allocation.c +0 -15
- data/ext/ruby_prof/rp_allocation.h +29 -33
- data/ext/ruby_prof/rp_call_tree.c +3 -0
- data/ext/ruby_prof/rp_call_tree.h +1 -4
- data/ext/ruby_prof/rp_call_trees.h +1 -4
- data/ext/ruby_prof/rp_measurement.c +0 -5
- data/ext/ruby_prof/rp_measurement.h +49 -53
- data/ext/ruby_prof/rp_method.c +3 -0
- data/ext/ruby_prof/rp_method.h +1 -4
- data/ext/ruby_prof/rp_profile.c +1 -1
- data/ext/ruby_prof/rp_profile.h +1 -5
- data/ext/ruby_prof/rp_stack.h +50 -53
- data/ext/ruby_prof/rp_thread.h +1 -4
- data/ext/ruby_prof/ruby_prof.h +1 -4
- data/ext/ruby_prof/vc/ruby_prof.vcxproj +7 -8
- data/lib/ruby-prof/assets/call_stack_printer.html.erb +746 -711
- data/lib/ruby-prof/assets/flame_graph_printer.html.erb +412 -0
- data/lib/ruby-prof/assets/graph_printer.html.erb +355 -355
- data/lib/ruby-prof/call_tree.rb +57 -57
- data/lib/ruby-prof/call_tree_visitor.rb +36 -36
- data/lib/ruby-prof/measurement.rb +17 -17
- data/lib/ruby-prof/printers/abstract_printer.rb +19 -33
- data/lib/ruby-prof/printers/call_info_printer.rb +53 -53
- data/lib/ruby-prof/printers/call_stack_printer.rb +168 -180
- data/lib/ruby-prof/printers/call_tree_printer.rb +132 -145
- data/lib/ruby-prof/printers/dot_printer.rb +177 -132
- data/lib/ruby-prof/printers/flame_graph_printer.rb +79 -0
- data/lib/ruby-prof/printers/flat_printer.rb +52 -52
- data/lib/ruby-prof/printers/graph_html_printer.rb +62 -63
- data/lib/ruby-prof/printers/graph_printer.rb +112 -113
- data/lib/ruby-prof/printers/multi_printer.rb +134 -127
- data/lib/ruby-prof/profile.rb +13 -0
- data/lib/ruby-prof/rack.rb +114 -105
- data/lib/ruby-prof/task.rb +147 -147
- data/lib/ruby-prof/thread.rb +20 -20
- data/lib/ruby-prof/version.rb +1 -1
- data/lib/ruby-prof.rb +50 -52
- data/lib/unprof.rb +10 -10
- data/ruby-prof.gemspec +5 -5
- data/test/abstract_printer_test.rb +25 -27
- data/test/alias_test.rb +203 -117
- data/test/call_tree_builder.rb +126 -126
- data/test/call_tree_visitor_test.rb +27 -27
- data/test/call_trees_test.rb +66 -66
- data/test/duplicate_names_test.rb +32 -32
- data/test/dynamic_method_test.rb +50 -50
- data/test/exceptions_test.rb +24 -24
- data/test/exclude_threads_test.rb +48 -48
- data/test/fiber_test.rb +72 -72
- data/test/inverse_call_tree_test.rb +174 -174
- data/test/line_number_test.rb +138 -1
- data/test/marshal_test.rb +144 -145
- data/test/measure_allocations.rb +26 -26
- data/test/measure_allocations_test.rb +340 -1
- data/test/measure_process_time_test.rb +3098 -3142
- data/test/measure_times.rb +56 -56
- data/test/measure_wall_time_test.rb +511 -372
- data/test/measurement_test.rb +82 -82
- data/test/merge_test.rb +48 -48
- data/test/multi_printer_test.rb +52 -66
- data/test/no_method_class_test.rb +15 -15
- data/test/pause_resume_test.rb +171 -171
- data/test/prime.rb +54 -54
- data/test/prime_script.rb +5 -5
- data/test/printer_call_stack_test.rb +28 -27
- data/test/printer_call_tree_test.rb +30 -30
- data/test/printer_flame_graph_test.rb +82 -0
- data/test/printer_flat_test.rb +99 -99
- data/test/printer_graph_html_test.rb +62 -59
- data/test/printer_graph_test.rb +42 -40
- data/test/printers_test.rb +28 -44
- data/test/printing_recursive_graph_test.rb +81 -81
- data/test/profile_test.rb +101 -101
- data/test/rack_test.rb +103 -93
- data/test/recursive_test.rb +139 -139
- data/test/scheduler.rb +4 -0
- data/test/singleton_test.rb +39 -38
- data/test/stack_printer_test.rb +61 -61
- data/test/start_stop_test.rb +106 -106
- data/test/test_helper.rb +4 -0
- data/test/thread_test.rb +29 -29
- data/test/unique_call_path_test.rb +123 -123
- data/test/yarv_test.rb +56 -56
- metadata +53 -11
- data/ext/ruby_prof/rp_measure_memory.c +0 -46
- data/lib/ruby-prof/compatibility.rb +0 -113
- data/test/compatibility_test.rb +0 -49
- data/test/measure_memory_test.rb +0 -1193
data/test/recursive_test.rb
CHANGED
|
@@ -50,10 +50,10 @@ class RecursiveTest < TestCase
|
|
|
50
50
|
assert_equal('RecursiveTest#test_simple', method.full_name)
|
|
51
51
|
assert_equal(1, method.called)
|
|
52
52
|
refute(method.recursive?)
|
|
53
|
-
assert_in_delta(2, method.total_time, 0.1)
|
|
54
|
-
assert_in_delta(0, method.self_time, 0.01)
|
|
55
|
-
assert_in_delta(0, method.wait_time, 0.01)
|
|
56
|
-
assert_in_delta(2, method.children_time, 0.1)
|
|
53
|
+
assert_in_delta(2, method.total_time, 0.1 * delta_multiplier)
|
|
54
|
+
assert_in_delta(0, method.self_time, 0.01 * delta_multiplier)
|
|
55
|
+
assert_in_delta(0, method.wait_time, 0.01 * delta_multiplier)
|
|
56
|
+
assert_in_delta(2, method.children_time, 0.1 * delta_multiplier)
|
|
57
57
|
|
|
58
58
|
assert_equal(0, method.call_trees.callers.length)
|
|
59
59
|
|
|
@@ -66,10 +66,10 @@ class RecursiveTest < TestCase
|
|
|
66
66
|
assert_equal('SimpleRecursion#simple', method.full_name)
|
|
67
67
|
assert_equal(2, method.called)
|
|
68
68
|
assert(method.recursive?)
|
|
69
|
-
assert_in_delta(2, method.total_time, 0.1)
|
|
70
|
-
assert_in_delta(0, method.self_time, 0.1)
|
|
71
|
-
assert_in_delta(0, method.wait_time, 0.1)
|
|
72
|
-
assert_in_delta(2, method.children_time, 0.1)
|
|
69
|
+
assert_in_delta(2, method.total_time, 0.1 * delta_multiplier)
|
|
70
|
+
assert_in_delta(0, method.self_time, 0.1 * delta_multiplier)
|
|
71
|
+
assert_in_delta(0, method.wait_time, 0.1 * delta_multiplier)
|
|
72
|
+
assert_in_delta(2, method.children_time, 0.1 * delta_multiplier)
|
|
73
73
|
|
|
74
74
|
assert_equal(2, method.call_trees.callers.length)
|
|
75
75
|
call_tree = method.call_trees.callers[0]
|
|
@@ -91,10 +91,10 @@ class RecursiveTest < TestCase
|
|
|
91
91
|
assert_equal(2, method.called)
|
|
92
92
|
refute(method.recursive?)
|
|
93
93
|
|
|
94
|
-
assert_in_delta(2, method.total_time, 0.1)
|
|
95
|
-
assert_in_delta(2, method.self_time, 0.1)
|
|
96
|
-
assert_in_delta(0, method.wait_time, 0.1)
|
|
97
|
-
assert_in_delta(0, method.children_time, 0.1)
|
|
94
|
+
assert_in_delta(2, method.total_time, 0.1 * delta_multiplier)
|
|
95
|
+
assert_in_delta(2, method.self_time, 0.1 * delta_multiplier)
|
|
96
|
+
assert_in_delta(0, method.wait_time, 0.1 * delta_multiplier)
|
|
97
|
+
assert_in_delta(0, method.children_time, 0.1 * delta_multiplier)
|
|
98
98
|
|
|
99
99
|
assert_equal(1, method.call_trees.callers.length)
|
|
100
100
|
call_tree = method.call_trees.callers[0]
|
|
@@ -110,10 +110,10 @@ class RecursiveTest < TestCase
|
|
|
110
110
|
assert_equal('RecursiveTest#test_simple', method.full_name)
|
|
111
111
|
assert_equal(1, method.called)
|
|
112
112
|
refute(method.recursive?)
|
|
113
|
-
assert_in_delta(2, method.total_time, 0.1)
|
|
114
|
-
assert_in_delta(0, method.self_time, 0.01)
|
|
115
|
-
assert_in_delta(0, method.wait_time, 0.01)
|
|
116
|
-
assert_in_delta(2, method.children_time, 0.1)
|
|
113
|
+
assert_in_delta(2, method.total_time, 0.1 * delta_multiplier)
|
|
114
|
+
assert_in_delta(0, method.self_time, 0.01 * delta_multiplier)
|
|
115
|
+
assert_in_delta(0, method.wait_time, 0.01 * delta_multiplier)
|
|
116
|
+
assert_in_delta(2, method.children_time, 0.1 * delta_multiplier)
|
|
117
117
|
|
|
118
118
|
assert_equal(0, method.call_trees.callers.length)
|
|
119
119
|
|
|
@@ -126,10 +126,10 @@ class RecursiveTest < TestCase
|
|
|
126
126
|
assert_equal('SimpleRecursion#simple', method.full_name)
|
|
127
127
|
assert_equal(2, method.called)
|
|
128
128
|
assert(method.recursive?)
|
|
129
|
-
assert_in_delta(2, method.total_time, 0.1)
|
|
130
|
-
assert_in_delta(0, method.self_time, 0.1)
|
|
131
|
-
assert_in_delta(0, method.wait_time, 0.1)
|
|
132
|
-
assert_in_delta(2, method.children_time, 0.1)
|
|
129
|
+
assert_in_delta(2, method.total_time, 0.1 * delta_multiplier)
|
|
130
|
+
assert_in_delta(0, method.self_time, 0.1 * delta_multiplier)
|
|
131
|
+
assert_in_delta(0, method.wait_time, 0.1 * delta_multiplier)
|
|
132
|
+
assert_in_delta(2, method.children_time, 0.1 * delta_multiplier)
|
|
133
133
|
|
|
134
134
|
assert_equal(2, method.call_trees.callers.length)
|
|
135
135
|
call_tree = method.call_trees.callers[0]
|
|
@@ -157,10 +157,10 @@ class RecursiveTest < TestCase
|
|
|
157
157
|
assert_equal(2, method.called)
|
|
158
158
|
refute(method.recursive?)
|
|
159
159
|
|
|
160
|
-
assert_in_delta(2, method.total_time, 0.1)
|
|
161
|
-
assert_in_delta(2, method.self_time, 0.1)
|
|
162
|
-
assert_in_delta(0, method.wait_time, 0.1)
|
|
163
|
-
assert_in_delta(0, method.children_time, 0.1)
|
|
160
|
+
assert_in_delta(2, method.total_time, 0.1 * delta_multiplier)
|
|
161
|
+
assert_in_delta(2, method.self_time, 0.1 * delta_multiplier)
|
|
162
|
+
assert_in_delta(0, method.wait_time, 0.1 * delta_multiplier)
|
|
163
|
+
assert_in_delta(0, method.children_time, 0.1 * delta_multiplier)
|
|
164
164
|
|
|
165
165
|
assert_equal(1, method.call_trees.callers.length)
|
|
166
166
|
call_tree = method.call_trees.callers[0]
|
|
@@ -210,10 +210,10 @@ class RecursiveTest < TestCase
|
|
|
210
210
|
assert_equal('RecursiveTest#test_cycle', method.full_name)
|
|
211
211
|
assert_equal(1, method.called)
|
|
212
212
|
refute(method.recursive?)
|
|
213
|
-
assert_in_delta(5, method.total_time, 0.1)
|
|
214
|
-
assert_in_delta(0, method.self_time, 0.01)
|
|
215
|
-
assert_in_delta(0, method.wait_time, 0.01)
|
|
216
|
-
assert_in_delta(5, method.children_time, 0.1)
|
|
213
|
+
assert_in_delta(5, method.total_time, 0.1 * delta_multiplier)
|
|
214
|
+
assert_in_delta(0, method.self_time, 0.01 * delta_multiplier)
|
|
215
|
+
assert_in_delta(0, method.wait_time, 0.01 * delta_multiplier)
|
|
216
|
+
assert_in_delta(5, method.children_time, 0.1 * delta_multiplier)
|
|
217
217
|
|
|
218
218
|
assert_equal(0, method.call_trees.callers.length)
|
|
219
219
|
|
|
@@ -226,10 +226,10 @@ class RecursiveTest < TestCase
|
|
|
226
226
|
assert_equal('SimpleRecursion#render', method.full_name)
|
|
227
227
|
assert_equal(1, method.called)
|
|
228
228
|
refute(method.recursive?)
|
|
229
|
-
assert_in_delta(5, method.total_time, 0.1)
|
|
230
|
-
assert_in_delta(0, method.self_time, 0.01)
|
|
231
|
-
assert_in_delta(0, method.wait_time, 0.01)
|
|
232
|
-
assert_in_delta(5, method.children_time, 0.1)
|
|
229
|
+
assert_in_delta(5, method.total_time, 0.1 * delta_multiplier)
|
|
230
|
+
assert_in_delta(0, method.self_time, 0.01 * delta_multiplier)
|
|
231
|
+
assert_in_delta(0, method.wait_time, 0.01 * delta_multiplier)
|
|
232
|
+
assert_in_delta(5, method.children_time, 0.1 * delta_multiplier)
|
|
233
233
|
|
|
234
234
|
assert_equal(1, method.call_trees.callers.length)
|
|
235
235
|
call_tree = method.call_trees.callers[0]
|
|
@@ -244,10 +244,10 @@ class RecursiveTest < TestCase
|
|
|
244
244
|
assert_equal('Integer#times', method.full_name)
|
|
245
245
|
assert_equal(2, method.called)
|
|
246
246
|
assert(method.recursive?)
|
|
247
|
-
assert_in_delta(5, method.total_time, 0.1)
|
|
248
|
-
assert_in_delta(0, method.self_time, 0.1)
|
|
249
|
-
assert_in_delta(0, method.wait_time, 0.1)
|
|
250
|
-
assert_in_delta(5, method.children_time, 0.1)
|
|
247
|
+
assert_in_delta(5, method.total_time, 0.1 * delta_multiplier)
|
|
248
|
+
assert_in_delta(0, method.self_time, 0.1 * delta_multiplier)
|
|
249
|
+
assert_in_delta(0, method.wait_time, 0.1 * delta_multiplier)
|
|
250
|
+
assert_in_delta(5, method.children_time, 0.1 * delta_multiplier)
|
|
251
251
|
|
|
252
252
|
assert_equal(2, method.call_trees.callers.length)
|
|
253
253
|
call_tree = method.call_trees.callers[0]
|
|
@@ -265,9 +265,9 @@ class RecursiveTest < TestCase
|
|
|
265
265
|
assert_equal('SimpleRecursion#render_partial', method.full_name)
|
|
266
266
|
assert_equal(5, method.called)
|
|
267
267
|
assert(method.recursive?)
|
|
268
|
-
assert_in_delta(5, method.total_time, 0.1)
|
|
269
|
-
assert_in_delta(0, method.self_time, 0.1)
|
|
270
|
-
assert_in_delta(0, method.wait_time, 0.01)
|
|
268
|
+
assert_in_delta(5, method.total_time, 0.1 * delta_multiplier)
|
|
269
|
+
assert_in_delta(0, method.self_time, 0.1 * delta_multiplier)
|
|
270
|
+
assert_in_delta(0, method.wait_time, 0.01 * delta_multiplier)
|
|
271
271
|
assert_in_delta(5, method.children_time, 0.05)
|
|
272
272
|
|
|
273
273
|
assert_equal(2, method.call_trees.callers.length)
|
|
@@ -292,10 +292,10 @@ class RecursiveTest < TestCase
|
|
|
292
292
|
assert_equal('Kernel#sleep', method.full_name)
|
|
293
293
|
assert_equal(5, method.called)
|
|
294
294
|
refute(method.recursive?)
|
|
295
|
-
assert_in_delta(5, method.total_time, 0.1)
|
|
296
|
-
assert_in_delta(5, method.self_time, 0.1)
|
|
297
|
-
assert_in_delta(0, method.wait_time, 0.01)
|
|
298
|
-
assert_in_delta(0, method.children_time, 0.01)
|
|
295
|
+
assert_in_delta(5, method.total_time, 0.1 * delta_multiplier)
|
|
296
|
+
assert_in_delta(5, method.self_time, 0.1 * delta_multiplier)
|
|
297
|
+
assert_in_delta(0, method.wait_time, 0.01 * delta_multiplier)
|
|
298
|
+
assert_in_delta(0, method.children_time, 0.01 * delta_multiplier)
|
|
299
299
|
|
|
300
300
|
assert_equal(1, method.call_trees.callers.length)
|
|
301
301
|
call_tree = method.call_trees.callers[0]
|
|
@@ -310,10 +310,10 @@ class RecursiveTest < TestCase
|
|
|
310
310
|
assert_equal('RecursiveTest#test_cycle', method.full_name)
|
|
311
311
|
assert_equal(1, method.called)
|
|
312
312
|
refute(method.recursive?)
|
|
313
|
-
assert_in_delta(5, method.total_time, 0.1)
|
|
314
|
-
assert_in_delta(0, method.self_time, 0.01)
|
|
315
|
-
assert_in_delta(0, method.wait_time, 0.01)
|
|
316
|
-
assert_in_delta(5, method.children_time, 0.1)
|
|
313
|
+
assert_in_delta(5, method.total_time, 0.1 * delta_multiplier)
|
|
314
|
+
assert_in_delta(0, method.self_time, 0.01 * delta_multiplier)
|
|
315
|
+
assert_in_delta(0, method.wait_time, 0.01 * delta_multiplier)
|
|
316
|
+
assert_in_delta(5, method.children_time, 0.1 * delta_multiplier)
|
|
317
317
|
|
|
318
318
|
assert_equal(0, method.call_trees.callers.length)
|
|
319
319
|
|
|
@@ -326,10 +326,10 @@ class RecursiveTest < TestCase
|
|
|
326
326
|
assert_equal('SimpleRecursion#render', method.full_name)
|
|
327
327
|
assert_equal(1, method.called)
|
|
328
328
|
refute(method.recursive?)
|
|
329
|
-
assert_in_delta(5, method.total_time, 0.1)
|
|
330
|
-
assert_in_delta(0, method.self_time, 0.01)
|
|
331
|
-
assert_in_delta(0, method.wait_time, 0.01)
|
|
332
|
-
assert_in_delta(5, method.children_time, 0.1)
|
|
329
|
+
assert_in_delta(5, method.total_time, 0.1 * delta_multiplier)
|
|
330
|
+
assert_in_delta(0, method.self_time, 0.01 * delta_multiplier)
|
|
331
|
+
assert_in_delta(0, method.wait_time, 0.01 * delta_multiplier)
|
|
332
|
+
assert_in_delta(5, method.children_time, 0.1 * delta_multiplier)
|
|
333
333
|
|
|
334
334
|
assert_equal(1, method.call_trees.callers.length)
|
|
335
335
|
call_tree = method.call_trees.callers[0]
|
|
@@ -344,10 +344,10 @@ class RecursiveTest < TestCase
|
|
|
344
344
|
assert_equal('Integer#times', method.full_name)
|
|
345
345
|
assert_equal(2, method.called)
|
|
346
346
|
assert(method.recursive?)
|
|
347
|
-
assert_in_delta(5, method.total_time, 0.1)
|
|
348
|
-
assert_in_delta(0, method.self_time, 0.1)
|
|
349
|
-
assert_in_delta(0, method.wait_time, 0.1)
|
|
350
|
-
assert_in_delta(5, method.children_time, 0.1)
|
|
347
|
+
assert_in_delta(5, method.total_time, 0.1 * delta_multiplier)
|
|
348
|
+
assert_in_delta(0, method.self_time, 0.1 * delta_multiplier)
|
|
349
|
+
assert_in_delta(0, method.wait_time, 0.1 * delta_multiplier)
|
|
350
|
+
assert_in_delta(5, method.children_time, 0.1 * delta_multiplier)
|
|
351
351
|
|
|
352
352
|
assert_equal(2, method.call_trees.callers.length)
|
|
353
353
|
call_tree = method.call_trees.callers[0]
|
|
@@ -367,10 +367,10 @@ class RecursiveTest < TestCase
|
|
|
367
367
|
assert_equal('SimpleRecursion#render_partial', method.full_name)
|
|
368
368
|
assert_equal(5, method.called)
|
|
369
369
|
assert(method.recursive?)
|
|
370
|
-
assert_in_delta(5, method.total_time, 0.1)
|
|
371
|
-
assert_in_delta(0, method.self_time, 0.1)
|
|
372
|
-
assert_in_delta(0, method.wait_time, 0.01)
|
|
373
|
-
assert_in_delta(5, method.children_time, 0.1)
|
|
370
|
+
assert_in_delta(5, method.total_time, 0.1 * delta_multiplier)
|
|
371
|
+
assert_in_delta(0, method.self_time, 0.1 * delta_multiplier)
|
|
372
|
+
assert_in_delta(0, method.wait_time, 0.01 * delta_multiplier)
|
|
373
|
+
assert_in_delta(5, method.children_time, 0.1 * delta_multiplier)
|
|
374
374
|
|
|
375
375
|
assert_equal(2, method.call_trees.callers.length)
|
|
376
376
|
call_tree = method.call_trees.callers[0]
|
|
@@ -394,10 +394,10 @@ class RecursiveTest < TestCase
|
|
|
394
394
|
assert_equal('Kernel#sleep', method.full_name)
|
|
395
395
|
assert_equal(5, method.called)
|
|
396
396
|
refute(method.recursive?)
|
|
397
|
-
assert_in_delta(5, method.total_time, 0.1)
|
|
398
|
-
assert_in_delta(5, method.self_time, 0.1)
|
|
399
|
-
assert_in_delta(0, method.wait_time, 0.01)
|
|
400
|
-
assert_in_delta(0, method.children_time, 0.01)
|
|
397
|
+
assert_in_delta(5, method.total_time, 0.1 * delta_multiplier)
|
|
398
|
+
assert_in_delta(5, method.self_time, 0.1 * delta_multiplier)
|
|
399
|
+
assert_in_delta(0, method.wait_time, 0.01 * delta_multiplier)
|
|
400
|
+
assert_in_delta(0, method.children_time, 0.01 * delta_multiplier)
|
|
401
401
|
|
|
402
402
|
assert_equal(1, method.call_trees.callers.length)
|
|
403
403
|
call_tree = method.call_trees.callers[0]
|
|
@@ -410,10 +410,10 @@ class RecursiveTest < TestCase
|
|
|
410
410
|
assert_equal('Integer#+', method.full_name)
|
|
411
411
|
assert_equal(2, method.called)
|
|
412
412
|
refute(method.recursive?)
|
|
413
|
-
assert_in_delta(0, method.total_time, 0.1)
|
|
414
|
-
assert_in_delta(0, method.self_time, 0.1)
|
|
415
|
-
assert_in_delta(0, method.wait_time, 0.01)
|
|
416
|
-
assert_in_delta(0, method.children_time, 0.01)
|
|
413
|
+
assert_in_delta(0, method.total_time, 0.1 * delta_multiplier)
|
|
414
|
+
assert_in_delta(0, method.self_time, 0.1 * delta_multiplier)
|
|
415
|
+
assert_in_delta(0, method.wait_time, 0.01 * delta_multiplier)
|
|
416
|
+
assert_in_delta(0, method.children_time, 0.01 * delta_multiplier)
|
|
417
417
|
|
|
418
418
|
assert_equal(1, method.call_trees.callers.length)
|
|
419
419
|
call_tree = method.call_trees.callers[0]
|
|
@@ -428,10 +428,10 @@ class RecursiveTest < TestCase
|
|
|
428
428
|
assert_equal('RecursiveTest#test_cycle', method.full_name)
|
|
429
429
|
assert_equal(1, method.called)
|
|
430
430
|
refute(method.recursive?)
|
|
431
|
-
assert_in_delta(5, method.total_time, 0.1)
|
|
432
|
-
assert_in_delta(0, method.self_time, 0.01)
|
|
433
|
-
assert_in_delta(0, method.wait_time, 0.01)
|
|
434
|
-
assert_in_delta(5, method.children_time, 0.1)
|
|
431
|
+
assert_in_delta(5, method.total_time, 0.1 * delta_multiplier)
|
|
432
|
+
assert_in_delta(0, method.self_time, 0.01 * delta_multiplier)
|
|
433
|
+
assert_in_delta(0, method.wait_time, 0.01 * delta_multiplier)
|
|
434
|
+
assert_in_delta(5, method.children_time, 0.1 * delta_multiplier)
|
|
435
435
|
|
|
436
436
|
assert_equal(0, method.call_trees.callers.length)
|
|
437
437
|
|
|
@@ -444,10 +444,10 @@ class RecursiveTest < TestCase
|
|
|
444
444
|
assert_equal('SimpleRecursion#render', method.full_name)
|
|
445
445
|
assert_equal(1, method.called)
|
|
446
446
|
refute(method.recursive?)
|
|
447
|
-
assert_in_delta(5, method.total_time, 0.1)
|
|
448
|
-
assert_in_delta(0, method.self_time, 0.01)
|
|
449
|
-
assert_in_delta(0, method.wait_time, 0.01)
|
|
450
|
-
assert_in_delta(5, method.children_time, 0.1)
|
|
447
|
+
assert_in_delta(5, method.total_time, 0.1 * delta_multiplier)
|
|
448
|
+
assert_in_delta(0, method.self_time, 0.01 * delta_multiplier)
|
|
449
|
+
assert_in_delta(0, method.wait_time, 0.01 * delta_multiplier)
|
|
450
|
+
assert_in_delta(5, method.children_time, 0.1 * delta_multiplier)
|
|
451
451
|
|
|
452
452
|
assert_equal(1, method.call_trees.callers.length)
|
|
453
453
|
call_tree = method.call_trees.callers[0]
|
|
@@ -462,10 +462,10 @@ class RecursiveTest < TestCase
|
|
|
462
462
|
assert_equal('Integer#times', method.full_name)
|
|
463
463
|
assert_equal(2, method.called)
|
|
464
464
|
assert(method.recursive?)
|
|
465
|
-
assert_in_delta(5, method.total_time, 0.1)
|
|
466
|
-
assert_in_delta(0, method.self_time, 0.1)
|
|
467
|
-
assert_in_delta(0, method.wait_time, 0.1)
|
|
468
|
-
assert_in_delta(5, method.children_time, 0.1)
|
|
465
|
+
assert_in_delta(5, method.total_time, 0.1 * delta_multiplier)
|
|
466
|
+
assert_in_delta(0, method.self_time, 0.1 * delta_multiplier)
|
|
467
|
+
assert_in_delta(0, method.wait_time, 0.1 * delta_multiplier)
|
|
468
|
+
assert_in_delta(5, method.children_time, 0.1 * delta_multiplier)
|
|
469
469
|
|
|
470
470
|
assert_equal(2, method.call_trees.callers.length)
|
|
471
471
|
call_tree = method.call_trees.callers[0]
|
|
@@ -492,10 +492,10 @@ class RecursiveTest < TestCase
|
|
|
492
492
|
|
|
493
493
|
call_tree = method.call_trees.callees[2]
|
|
494
494
|
assert_equal('SimpleRecursion#render_partial', call_tree.target.full_name)
|
|
495
|
-
assert_in_delta(7.0, call_tree.total_time, 0.1)
|
|
495
|
+
assert_in_delta(7.0, call_tree.total_time, 0.1 * delta_multiplier)
|
|
496
496
|
assert_in_delta(0, call_tree.wait_time)
|
|
497
497
|
assert_in_delta(0, call_tree.self_time)
|
|
498
|
-
assert_in_delta(7.0, call_tree.children_time, 0.1)
|
|
498
|
+
assert_in_delta(7.0, call_tree.children_time, 0.1 * delta_multiplier)
|
|
499
499
|
|
|
500
500
|
call_tree = method.call_trees.callees[3]
|
|
501
501
|
assert_equal('Integer#succ', call_tree.target.full_name)
|
|
@@ -516,10 +516,10 @@ class RecursiveTest < TestCase
|
|
|
516
516
|
assert_equal('SimpleRecursion#render_partial', method.full_name)
|
|
517
517
|
assert_equal(5, method.called)
|
|
518
518
|
assert(method.recursive?)
|
|
519
|
-
assert_in_delta(5, method.total_time, 0.1)
|
|
520
|
-
assert_in_delta(0, method.self_time, 0.1)
|
|
521
|
-
assert_in_delta(0, method.wait_time, 0.01)
|
|
522
|
-
assert_in_delta(5, method.children_time, 0.1)
|
|
519
|
+
assert_in_delta(5, method.total_time, 0.1 * delta_multiplier)
|
|
520
|
+
assert_in_delta(0, method.self_time, 0.1 * delta_multiplier)
|
|
521
|
+
assert_in_delta(0, method.wait_time, 0.01 * delta_multiplier)
|
|
522
|
+
assert_in_delta(5, method.children_time, 0.1 * delta_multiplier)
|
|
523
523
|
|
|
524
524
|
assert_equal(2, method.call_trees.callers.length)
|
|
525
525
|
call_tree = method.call_trees.callers[0]
|
|
@@ -543,10 +543,10 @@ class RecursiveTest < TestCase
|
|
|
543
543
|
assert_equal('Kernel#sleep', method.full_name)
|
|
544
544
|
assert_equal(5, method.called)
|
|
545
545
|
refute(method.recursive?)
|
|
546
|
-
assert_in_delta(5, method.total_time, 0.1)
|
|
547
|
-
assert_in_delta(5, method.self_time, 0.1)
|
|
548
|
-
assert_in_delta(0, method.wait_time, 0.01)
|
|
549
|
-
assert_in_delta(0, method.children_time, 0.01)
|
|
546
|
+
assert_in_delta(5, method.total_time, 0.1 * delta_multiplier)
|
|
547
|
+
assert_in_delta(5, method.self_time, 0.1 * delta_multiplier)
|
|
548
|
+
assert_in_delta(0, method.wait_time, 0.01 * delta_multiplier)
|
|
549
|
+
assert_in_delta(0, method.children_time, 0.01 * delta_multiplier)
|
|
550
550
|
|
|
551
551
|
assert_equal(1, method.call_trees.callers.length)
|
|
552
552
|
call_tree = method.call_trees.callers[0]
|
|
@@ -559,10 +559,10 @@ class RecursiveTest < TestCase
|
|
|
559
559
|
assert_equal('Kernel#block_given?', method.full_name)
|
|
560
560
|
assert_equal(2, method.called)
|
|
561
561
|
refute(method.recursive?)
|
|
562
|
-
assert_in_delta(0, method.total_time, 0.1)
|
|
563
|
-
assert_in_delta(0, method.self_time, 0.1)
|
|
564
|
-
assert_in_delta(0, method.wait_time, 0.01)
|
|
565
|
-
assert_in_delta(0, method.children_time, 0.01)
|
|
562
|
+
assert_in_delta(0, method.total_time, 0.1 * delta_multiplier)
|
|
563
|
+
assert_in_delta(0, method.self_time, 0.1 * delta_multiplier)
|
|
564
|
+
assert_in_delta(0, method.wait_time, 0.01 * delta_multiplier)
|
|
565
|
+
assert_in_delta(0, method.children_time, 0.01 * delta_multiplier)
|
|
566
566
|
|
|
567
567
|
assert_equal(1, method.call_trees.callers.length)
|
|
568
568
|
call_tree = method.call_trees.callers[0]
|
|
@@ -575,10 +575,10 @@ class RecursiveTest < TestCase
|
|
|
575
575
|
assert_equal('Integer#succ', method.full_name)
|
|
576
576
|
assert_equal(4, method.called)
|
|
577
577
|
refute(method.recursive?)
|
|
578
|
-
assert_in_delta(0, method.total_time, 0.1)
|
|
579
|
-
assert_in_delta(0, method.self_time, 0.1)
|
|
580
|
-
assert_in_delta(0, method.wait_time, 0.01)
|
|
581
|
-
assert_in_delta(0, method.children_time, 0.01)
|
|
578
|
+
assert_in_delta(0, method.total_time, 0.1 * delta_multiplier)
|
|
579
|
+
assert_in_delta(0, method.self_time, 0.1 * delta_multiplier)
|
|
580
|
+
assert_in_delta(0, method.wait_time, 0.01 * delta_multiplier)
|
|
581
|
+
assert_in_delta(0, method.children_time, 0.01 * delta_multiplier)
|
|
582
582
|
|
|
583
583
|
assert_equal(1, method.call_trees.callers.length)
|
|
584
584
|
call_tree = method.call_trees.callers[0]
|
|
@@ -591,10 +591,10 @@ class RecursiveTest < TestCase
|
|
|
591
591
|
assert_equal('Integer#<', method.full_name)
|
|
592
592
|
assert_equal(6, method.called)
|
|
593
593
|
refute(method.recursive?)
|
|
594
|
-
assert_in_delta(0, method.total_time, 0.1)
|
|
595
|
-
assert_in_delta(0, method.self_time, 0.1)
|
|
596
|
-
assert_in_delta(0, method.wait_time, 0.01)
|
|
597
|
-
assert_in_delta(0, method.children_time, 0.01)
|
|
594
|
+
assert_in_delta(0, method.total_time, 0.1 * delta_multiplier)
|
|
595
|
+
assert_in_delta(0, method.self_time, 0.1 * delta_multiplier)
|
|
596
|
+
assert_in_delta(0, method.wait_time, 0.01 * delta_multiplier)
|
|
597
|
+
assert_in_delta(0, method.children_time, 0.01 * delta_multiplier)
|
|
598
598
|
|
|
599
599
|
assert_equal(1, method.call_trees.callers.length)
|
|
600
600
|
call_tree = method.call_trees.callers[0]
|
|
@@ -607,10 +607,10 @@ class RecursiveTest < TestCase
|
|
|
607
607
|
assert_equal('Integer#+', method.full_name)
|
|
608
608
|
assert_equal(2, method.called)
|
|
609
609
|
refute(method.recursive?)
|
|
610
|
-
assert_in_delta(0, method.total_time, 0.1)
|
|
611
|
-
assert_in_delta(0, method.self_time, 0.1)
|
|
612
|
-
assert_in_delta(0, method.wait_time, 0.01)
|
|
613
|
-
assert_in_delta(0, method.children_time, 0.01)
|
|
610
|
+
assert_in_delta(0, method.total_time, 0.1 * delta_multiplier)
|
|
611
|
+
assert_in_delta(0, method.self_time, 0.1 * delta_multiplier)
|
|
612
|
+
assert_in_delta(0, method.wait_time, 0.01 * delta_multiplier)
|
|
613
|
+
assert_in_delta(0, method.children_time, 0.01 * delta_multiplier)
|
|
614
614
|
|
|
615
615
|
assert_equal(1, method.call_trees.callers.length)
|
|
616
616
|
call_tree = method.call_trees.callers[0]
|
|
@@ -625,10 +625,10 @@ class RecursiveTest < TestCase
|
|
|
625
625
|
assert_equal('RecursiveTest#test_cycle', method.full_name)
|
|
626
626
|
assert_equal(1, method.called)
|
|
627
627
|
refute(method.recursive?)
|
|
628
|
-
assert_in_delta(5, method.total_time, 0.1)
|
|
629
|
-
assert_in_delta(0, method.self_time, 0.01)
|
|
630
|
-
assert_in_delta(0, method.wait_time, 0.01)
|
|
631
|
-
assert_in_delta(5, method.children_time, 0.1)
|
|
628
|
+
assert_in_delta(5, method.total_time, 0.1 * delta_multiplier)
|
|
629
|
+
assert_in_delta(0, method.self_time, 0.01 * delta_multiplier)
|
|
630
|
+
assert_in_delta(0, method.wait_time, 0.01 * delta_multiplier)
|
|
631
|
+
assert_in_delta(5, method.children_time, 0.1 * delta_multiplier)
|
|
632
632
|
|
|
633
633
|
assert_equal(0, method.call_trees.callers.length)
|
|
634
634
|
|
|
@@ -641,10 +641,10 @@ class RecursiveTest < TestCase
|
|
|
641
641
|
assert_equal('SimpleRecursion#render', method.full_name)
|
|
642
642
|
assert_equal(1, method.called)
|
|
643
643
|
refute(method.recursive?)
|
|
644
|
-
assert_in_delta(5, method.total_time, 0.1)
|
|
645
|
-
assert_in_delta(0, method.self_time, 0.01)
|
|
646
|
-
assert_in_delta(0, method.wait_time, 0.01)
|
|
647
|
-
assert_in_delta(5, method.children_time, 0.1)
|
|
644
|
+
assert_in_delta(5, method.total_time, 0.1 * delta_multiplier)
|
|
645
|
+
assert_in_delta(0, method.self_time, 0.01 * delta_multiplier)
|
|
646
|
+
assert_in_delta(0, method.wait_time, 0.01 * delta_multiplier)
|
|
647
|
+
assert_in_delta(5, method.children_time, 0.1 * delta_multiplier)
|
|
648
648
|
|
|
649
649
|
assert_equal(1, method.call_trees.callers.length)
|
|
650
650
|
call_tree = method.call_trees.callers[0]
|
|
@@ -659,10 +659,10 @@ class RecursiveTest < TestCase
|
|
|
659
659
|
assert_equal('Integer#times', method.full_name)
|
|
660
660
|
assert_equal(2, method.called)
|
|
661
661
|
assert(method.recursive?)
|
|
662
|
-
assert_in_delta(5, method.total_time, 0.1)
|
|
663
|
-
assert_in_delta(0, method.self_time, 0.1)
|
|
664
|
-
assert_in_delta(0, method.wait_time, 0.1)
|
|
665
|
-
assert_in_delta(5, method.children_time, 0.1)
|
|
662
|
+
assert_in_delta(5, method.total_time, 0.1 * delta_multiplier)
|
|
663
|
+
assert_in_delta(0, method.self_time, 0.1 * delta_multiplier)
|
|
664
|
+
assert_in_delta(0, method.wait_time, 0.1 * delta_multiplier)
|
|
665
|
+
assert_in_delta(5, method.children_time, 0.1 * delta_multiplier)
|
|
666
666
|
|
|
667
667
|
assert_equal(2, method.call_trees.callers.length)
|
|
668
668
|
call_tree = method.call_trees.callers[0]
|
|
@@ -682,10 +682,10 @@ class RecursiveTest < TestCase
|
|
|
682
682
|
|
|
683
683
|
call_tree = method.call_trees.callees[1]
|
|
684
684
|
assert_equal('SimpleRecursion#render_partial', call_tree.target.full_name)
|
|
685
|
-
assert_in_delta(7.0, call_tree.total_time, 0.1)
|
|
685
|
+
assert_in_delta(7.0, call_tree.total_time, 0.1 * delta_multiplier)
|
|
686
686
|
assert_in_delta(0, call_tree.wait_time)
|
|
687
687
|
assert_in_delta(0, call_tree.self_time)
|
|
688
|
-
assert_in_delta(7.0, call_tree.children_time, 0.1)
|
|
688
|
+
assert_in_delta(7.0, call_tree.children_time, 0.1 * delta_multiplier)
|
|
689
689
|
|
|
690
690
|
call_tree = method.call_trees.callees[2]
|
|
691
691
|
assert_equal('Integer#succ', call_tree.target.full_name)
|
|
@@ -706,10 +706,10 @@ class RecursiveTest < TestCase
|
|
|
706
706
|
assert_equal('SimpleRecursion#render_partial', method.full_name)
|
|
707
707
|
assert_equal(5, method.called)
|
|
708
708
|
assert(method.recursive?)
|
|
709
|
-
assert_in_delta(5, method.total_time, 0.1)
|
|
710
|
-
assert_in_delta(0, method.self_time, 0.1)
|
|
711
|
-
assert_in_delta(0, method.wait_time, 0.01)
|
|
712
|
-
assert_in_delta(5, method.children_time, 0.1)
|
|
709
|
+
assert_in_delta(5, method.total_time, 0.1 * delta_multiplier)
|
|
710
|
+
assert_in_delta(0, method.self_time, 0.1 * delta_multiplier)
|
|
711
|
+
assert_in_delta(0, method.wait_time, 0.01 * delta_multiplier)
|
|
712
|
+
assert_in_delta(5, method.children_time, 0.1 * delta_multiplier)
|
|
713
713
|
|
|
714
714
|
assert_equal(2, method.call_trees.callers.length)
|
|
715
715
|
call_tree = method.call_trees.callers[0]
|
|
@@ -733,10 +733,10 @@ class RecursiveTest < TestCase
|
|
|
733
733
|
assert_equal('Kernel#sleep', method.full_name)
|
|
734
734
|
assert_equal(5, method.called)
|
|
735
735
|
refute(method.recursive?)
|
|
736
|
-
assert_in_delta(5, method.total_time, 0.1)
|
|
737
|
-
assert_in_delta(5, method.self_time, 0.1)
|
|
738
|
-
assert_in_delta(0, method.wait_time, 0.01)
|
|
739
|
-
assert_in_delta(0, method.children_time, 0.01)
|
|
736
|
+
assert_in_delta(5, method.total_time, 0.1 * delta_multiplier)
|
|
737
|
+
assert_in_delta(5, method.self_time, 0.1 * delta_multiplier)
|
|
738
|
+
assert_in_delta(0, method.wait_time, 0.01 * delta_multiplier)
|
|
739
|
+
assert_in_delta(0, method.children_time, 0.01 * delta_multiplier)
|
|
740
740
|
|
|
741
741
|
assert_equal(1, method.call_trees.callers.length)
|
|
742
742
|
call_tree = method.call_trees.callers[0]
|
|
@@ -749,10 +749,10 @@ class RecursiveTest < TestCase
|
|
|
749
749
|
assert_equal('Integer#succ', method.full_name)
|
|
750
750
|
assert_equal(4, method.called)
|
|
751
751
|
refute(method.recursive?)
|
|
752
|
-
assert_in_delta(0, method.total_time, 0.1)
|
|
753
|
-
assert_in_delta(0, method.self_time, 0.1)
|
|
754
|
-
assert_in_delta(0, method.wait_time, 0.01)
|
|
755
|
-
assert_in_delta(0, method.children_time, 0.01)
|
|
752
|
+
assert_in_delta(0, method.total_time, 0.1 * delta_multiplier)
|
|
753
|
+
assert_in_delta(0, method.self_time, 0.1 * delta_multiplier)
|
|
754
|
+
assert_in_delta(0, method.wait_time, 0.01 * delta_multiplier)
|
|
755
|
+
assert_in_delta(0, method.children_time, 0.01 * delta_multiplier)
|
|
756
756
|
|
|
757
757
|
assert_equal(1, method.call_trees.callers.length)
|
|
758
758
|
call_tree = method.call_trees.callers[0]
|
|
@@ -765,10 +765,10 @@ class RecursiveTest < TestCase
|
|
|
765
765
|
assert_equal('Integer#<', method.full_name)
|
|
766
766
|
assert_equal(6, method.called)
|
|
767
767
|
refute(method.recursive?)
|
|
768
|
-
assert_in_delta(0, method.total_time, 0.1)
|
|
769
|
-
assert_in_delta(0, method.self_time, 0.1)
|
|
770
|
-
assert_in_delta(0, method.wait_time, 0.01)
|
|
771
|
-
assert_in_delta(0, method.children_time, 0.01)
|
|
768
|
+
assert_in_delta(0, method.total_time, 0.1 * delta_multiplier)
|
|
769
|
+
assert_in_delta(0, method.self_time, 0.1 * delta_multiplier)
|
|
770
|
+
assert_in_delta(0, method.wait_time, 0.01 * delta_multiplier)
|
|
771
|
+
assert_in_delta(0, method.children_time, 0.01 * delta_multiplier)
|
|
772
772
|
|
|
773
773
|
assert_equal(1, method.call_trees.callers.length)
|
|
774
774
|
call_tree = method.call_trees.callers[0]
|
|
@@ -781,10 +781,10 @@ class RecursiveTest < TestCase
|
|
|
781
781
|
assert_equal('Integer#+', method.full_name)
|
|
782
782
|
assert_equal(2, method.called)
|
|
783
783
|
refute(method.recursive?)
|
|
784
|
-
assert_in_delta(0, method.total_time, 0.1)
|
|
785
|
-
assert_in_delta(0, method.self_time, 0.1)
|
|
786
|
-
assert_in_delta(0, method.wait_time, 0.01)
|
|
787
|
-
assert_in_delta(0, method.children_time, 0.01)
|
|
784
|
+
assert_in_delta(0, method.total_time, 0.1 * delta_multiplier)
|
|
785
|
+
assert_in_delta(0, method.self_time, 0.1 * delta_multiplier)
|
|
786
|
+
assert_in_delta(0, method.wait_time, 0.01 * delta_multiplier)
|
|
787
|
+
assert_in_delta(0, method.children_time, 0.01 * delta_multiplier)
|
|
788
788
|
|
|
789
789
|
assert_equal(1, method.call_trees.callers.length)
|
|
790
790
|
call_tree = method.call_trees.callers[0]
|
data/test/scheduler.rb
CHANGED
data/test/singleton_test.rb
CHANGED
|
@@ -1,38 +1,39 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
# encoding: UTF-8
|
|
3
|
-
|
|
4
|
-
require File.expand_path('../test_helper', __FILE__)
|
|
5
|
-
require '
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
#
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
a
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
end
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# encoding: UTF-8
|
|
3
|
+
|
|
4
|
+
require File.expand_path('../test_helper', __FILE__)
|
|
5
|
+
require 'stringio'
|
|
6
|
+
require 'timeout'
|
|
7
|
+
|
|
8
|
+
# -- Test for bug [#5657]
|
|
9
|
+
# http://rubyforge.org/tracker/index.php?func=detail&aid=5657&group_id=1814&atid=7060
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class A
|
|
13
|
+
attr_accessor :as
|
|
14
|
+
def initialize
|
|
15
|
+
@as = []
|
|
16
|
+
class << @as
|
|
17
|
+
def <<(an_a)
|
|
18
|
+
super
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def <<(an_a)
|
|
24
|
+
@as << an_a
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
class SingletonTest < TestCase
|
|
29
|
+
def test_singleton
|
|
30
|
+
result = RubyProf::Profile.profile do
|
|
31
|
+
a = A.new
|
|
32
|
+
a << :first_thing
|
|
33
|
+
assert_equal(1, a.as.size)
|
|
34
|
+
end
|
|
35
|
+
printer = RubyProf::FlatPrinter.new(result)
|
|
36
|
+
output = ENV['SHOW_RUBY_PROF_PRINTER_OUTPUT'] == "1" ? STDOUT : StringIO.new
|
|
37
|
+
printer.print(output)
|
|
38
|
+
end
|
|
39
|
+
end
|