ruby-prof 0.16.2 → 0.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES +15 -0
- data/README.rdoc +36 -5
- data/bin/ruby-prof +7 -2
- data/doc/LICENSE.html +2 -1
- data/doc/README_rdoc.html +42 -8
- data/doc/Rack.html +2 -1
- data/doc/Rack/RubyProf.html +25 -18
- data/doc/Rack/RubyProf/RackProfiler.html +343 -0
- data/doc/RubyProf.html +14 -2
- data/doc/RubyProf/AbstractPrinter.html +91 -12
- data/doc/RubyProf/AggregateCallInfo.html +2 -1
- data/doc/RubyProf/CallInfo.html +18 -78
- data/doc/RubyProf/CallInfoPrinter.html +2 -1
- data/doc/RubyProf/CallInfoVisitor.html +2 -1
- data/doc/RubyProf/CallStackPrinter.html +35 -29
- data/doc/RubyProf/CallTreePrinter.html +98 -14
- data/doc/RubyProf/Cmd.html +11 -5
- data/doc/RubyProf/DeprecationWarnings.html +148 -0
- data/doc/RubyProf/DotPrinter.html +2 -1
- data/doc/RubyProf/FlatPrinter.html +2 -1
- data/doc/RubyProf/FlatPrinterWithLineNumbers.html +7 -5
- data/doc/RubyProf/GraphHtmlPrinter.html +18 -12
- data/doc/RubyProf/GraphPrinter.html +2 -1
- data/doc/RubyProf/MethodInfo.html +19 -88
- data/doc/RubyProf/MultiPrinter.html +231 -17
- data/doc/RubyProf/Profile.html +184 -39
- data/doc/RubyProf/Profile/ExcludeCommonMethods.html +411 -0
- data/doc/RubyProf/Profile/LegacyMethodElimination.html +158 -0
- data/doc/RubyProf/ProfileTask.html +2 -1
- data/doc/RubyProf/Thread.html +4 -39
- data/doc/created.rid +21 -19
- data/doc/css/fonts.css +6 -6
- data/doc/examples/flat_txt.html +2 -1
- data/doc/examples/graph_html.html +2 -1
- data/doc/examples/graph_txt.html +2 -1
- data/doc/index.html +47 -7
- data/doc/js/darkfish.js +7 -7
- data/doc/js/search_index.js +1 -1
- data/doc/js/search_index.js.gz +0 -0
- data/doc/js/searcher.js +1 -0
- data/doc/js/searcher.js.gz +0 -0
- data/doc/table_of_contents.html +190 -80
- data/ext/ruby_prof/extconf.rb +4 -0
- data/ext/ruby_prof/rp_call_info.c +19 -1
- data/ext/ruby_prof/rp_call_info.h +8 -3
- data/ext/ruby_prof/rp_method.c +282 -57
- data/ext/ruby_prof/rp_method.h +28 -5
- data/ext/ruby_prof/rp_stack.c +69 -24
- data/ext/ruby_prof/rp_stack.h +21 -9
- data/ext/ruby_prof/rp_thread.c +4 -1
- data/ext/ruby_prof/ruby_prof.c +142 -39
- data/ext/ruby_prof/ruby_prof.h +3 -0
- data/lib/ruby-prof.rb +10 -0
- data/lib/ruby-prof/call_info.rb +0 -11
- data/lib/ruby-prof/method_info.rb +4 -12
- data/lib/ruby-prof/printers/abstract_printer.rb +19 -1
- data/lib/ruby-prof/printers/call_info_printer.rb +1 -1
- data/lib/ruby-prof/printers/call_stack_printer.rb +9 -4
- data/lib/ruby-prof/printers/call_tree_printer.rb +15 -2
- data/lib/ruby-prof/printers/flat_printer_with_line_numbers.rb +23 -4
- data/lib/ruby-prof/printers/graph_html_printer.rb +10 -5
- data/lib/ruby-prof/printers/graph_printer.rb +2 -2
- data/lib/ruby-prof/printers/multi_printer.rb +44 -18
- data/lib/ruby-prof/profile.rb +13 -42
- data/lib/ruby-prof/profile/exclude_common_methods.rb +201 -0
- data/lib/ruby-prof/profile/legacy_method_elimination.rb +49 -0
- data/lib/ruby-prof/rack.rb +130 -51
- data/lib/ruby-prof/thread.rb +0 -6
- data/lib/ruby-prof/version.rb +1 -1
- data/ruby-prof.gemspec +4 -3
- data/test/aggregate_test.rb +1 -1
- data/test/exclude_methods_test.rb +146 -0
- data/test/line_number_test.rb +12 -3
- data/test/multi_printer_test.rb +23 -2
- data/test/no_method_class_test.rb +1 -1
- data/test/printers_test.rb +21 -1
- data/test/rack_test.rb +64 -0
- data/test/recursive_test.rb +15 -15
- data/test/test_helper.rb +11 -0
- metadata +20 -13
@@ -8,6 +8,7 @@
|
|
8
8
|
|
9
9
|
<script type="text/javascript">
|
10
10
|
var rdoc_rel_prefix = "../";
|
11
|
+
var index_rel_prefix = "../";
|
11
12
|
</script>
|
12
13
|
|
13
14
|
<script src="../js/jquery.js"></script>
|
@@ -70,6 +71,8 @@
|
|
70
71
|
|
71
72
|
<ul class="link-list" role="directory">
|
72
73
|
|
74
|
+
<li ><a href="#method-c-needs_dir-3F">::needs_dir?</a>
|
75
|
+
|
73
76
|
<li ><a href="#method-c-new">::new</a>
|
74
77
|
|
75
78
|
<li ><a href="#method-i-flat_profile">#flat_profile</a>
|
@@ -78,10 +81,20 @@
|
|
78
81
|
|
79
82
|
<li ><a href="#method-i-print">#print</a>
|
80
83
|
|
84
|
+
<li ><a href="#method-i-print_to_flat">#print_to_flat</a>
|
85
|
+
|
86
|
+
<li ><a href="#method-i-print_to_graph">#print_to_graph</a>
|
87
|
+
|
88
|
+
<li ><a href="#method-i-print_to_stack">#print_to_stack</a>
|
89
|
+
|
90
|
+
<li ><a href="#method-i-print_to_tree">#print_to_tree</a>
|
91
|
+
|
81
92
|
<li ><a href="#method-i-stack_profile">#stack_profile</a>
|
82
93
|
|
83
94
|
<li ><a href="#method-i-tree_profile">#tree_profile</a>
|
84
95
|
|
96
|
+
<li ><a href="#method-i-validate_print_params">#validate_print_params</a>
|
97
|
+
|
85
98
|
</ul>
|
86
99
|
</div>
|
87
100
|
|
@@ -120,11 +133,44 @@ stack profile and a graph profile.</p>
|
|
120
133
|
</header>
|
121
134
|
|
122
135
|
|
136
|
+
<div id="method-c-needs_dir-3F" class="method-detail ">
|
137
|
+
|
138
|
+
<div class="method-heading">
|
139
|
+
<span class="method-name">needs_dir?</span><span
|
140
|
+
class="method-args">()</span>
|
141
|
+
|
142
|
+
<span class="method-click-advice">click to toggle source</span>
|
143
|
+
|
144
|
+
</div>
|
145
|
+
|
146
|
+
|
147
|
+
<div class="method-description">
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
<div class="method-source-code" id="needs_dir-3F-source">
|
155
|
+
<pre><span class="ruby-comment"># File lib/ruby-prof/printers/multi_printer.rb, line 14</span>
|
156
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">needs_dir?</span>
|
157
|
+
<span class="ruby-keyword">true</span>
|
158
|
+
<span class="ruby-keyword">end</span></pre>
|
159
|
+
</div>
|
160
|
+
|
161
|
+
</div>
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
</div>
|
167
|
+
|
168
|
+
|
123
169
|
<div id="method-c-new" class="method-detail ">
|
124
170
|
|
125
171
|
<div class="method-heading">
|
126
172
|
<span class="method-name">new</span><span
|
127
|
-
class="method-args">(result)</span>
|
173
|
+
class="method-args">(result, printers = [:stack, :graph, :tree, :flat])</span>
|
128
174
|
|
129
175
|
<span class="method-click-advice">click to toggle source</span>
|
130
176
|
|
@@ -140,11 +186,11 @@ stack profile and a graph profile.</p>
|
|
140
186
|
|
141
187
|
<div class="method-source-code" id="new-source">
|
142
188
|
<pre><span class="ruby-comment"># File lib/ruby-prof/printers/multi_printer.rb, line 7</span>
|
143
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">result</span>)
|
144
|
-
<span class="ruby-ivar">@stack_printer</span> = <span class="ruby-constant">CallStackPrinter</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">result</span>)
|
145
|
-
<span class="ruby-ivar">@graph_printer</span> = <span class="ruby-constant">GraphHtmlPrinter</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">result</span>)
|
146
|
-
<span class="ruby-ivar">@tree_printer</span> = <span class="ruby-constant">CallTreePrinter</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">result</span>)
|
147
|
-
<span class="ruby-ivar">@flat_printer</span> = <span class="ruby-constant">FlatPrinter</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">result</span>)
|
189
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">result</span>, <span class="ruby-identifier">printers</span> = [<span class="ruby-value">:stack</span>, <span class="ruby-value">:graph</span>, <span class="ruby-value">:tree</span>, <span class="ruby-value">:flat</span>])
|
190
|
+
<span class="ruby-ivar">@stack_printer</span> = <span class="ruby-constant">CallStackPrinter</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">result</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">printers</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-value">:stack</span>)
|
191
|
+
<span class="ruby-ivar">@graph_printer</span> = <span class="ruby-constant">GraphHtmlPrinter</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">result</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">printers</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-value">:graph</span>)
|
192
|
+
<span class="ruby-ivar">@tree_printer</span> = <span class="ruby-constant">CallTreePrinter</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">result</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">printers</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-value">:tree</span>)
|
193
|
+
<span class="ruby-ivar">@flat_printer</span> = <span class="ruby-constant">FlatPrinter</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">result</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">printers</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-value">:flat</span>)
|
148
194
|
<span class="ruby-keyword">end</span></pre>
|
149
195
|
</div>
|
150
196
|
|
@@ -183,7 +229,7 @@ stack profile and a graph profile.</p>
|
|
183
229
|
|
184
230
|
|
185
231
|
<div class="method-source-code" id="flat_profile-source">
|
186
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/printers/multi_printer.rb, line
|
232
|
+
<pre><span class="ruby-comment"># File lib/ruby-prof/printers/multi_printer.rb, line 49</span>
|
187
233
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">flat_profile</span>
|
188
234
|
<span class="ruby-node">"#{@directory}/#{@profile}.flat.txt"</span>
|
189
235
|
<span class="ruby-keyword">end</span></pre>
|
@@ -216,7 +262,7 @@ stack profile and a graph profile.</p>
|
|
216
262
|
|
217
263
|
|
218
264
|
<div class="method-source-code" id="graph_profile-source">
|
219
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/printers/multi_printer.rb, line
|
265
|
+
<pre><span class="ruby-comment"># File lib/ruby-prof/printers/multi_printer.rb, line 39</span>
|
220
266
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">graph_profile</span>
|
221
267
|
<span class="ruby-node">"#{@directory}/#{@profile}.graph.html"</span>
|
222
268
|
<span class="ruby-keyword">end</span></pre>
|
@@ -251,23 +297,121 @@ pofile file, defaults to “profile”.</p>
|
|
251
297
|
|
252
298
|
|
253
299
|
<div class="method-source-code" id="print-source">
|
254
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/printers/multi_printer.rb, line
|
300
|
+
<pre><span class="ruby-comment"># File lib/ruby-prof/printers/multi_printer.rb, line 21</span>
|
255
301
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">print</span>(<span class="ruby-identifier">options</span>)
|
302
|
+
<span class="ruby-identifier">validate_print_params</span>(<span class="ruby-identifier">options</span>)
|
303
|
+
|
256
304
|
<span class="ruby-ivar">@profile</span> = <span class="ruby-identifier">options</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value">:profile</span>) <span class="ruby-operator">||</span> <span class="ruby-string">"profile"</span>
|
257
305
|
<span class="ruby-ivar">@directory</span> = <span class="ruby-identifier">options</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value">:path</span>) <span class="ruby-operator">||</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-string">"."</span>)
|
258
306
|
|
259
|
-
<span class="ruby-
|
260
|
-
|
307
|
+
<span class="ruby-identifier">print_to_stack</span>(<span class="ruby-identifier">options</span>) <span class="ruby-keyword">if</span> <span class="ruby-ivar">@stack_printer</span>
|
308
|
+
<span class="ruby-identifier">print_to_graph</span>(<span class="ruby-identifier">options</span>) <span class="ruby-keyword">if</span> <span class="ruby-ivar">@graph_printer</span>
|
309
|
+
<span class="ruby-identifier">print_to_tree</span>(<span class="ruby-identifier">options</span>) <span class="ruby-keyword">if</span> <span class="ruby-ivar">@tree_printer</span>
|
310
|
+
<span class="ruby-identifier">print_to_flat</span>(<span class="ruby-identifier">options</span>) <span class="ruby-keyword">if</span> <span class="ruby-ivar">@flat_printer</span>
|
311
|
+
<span class="ruby-keyword">end</span></pre>
|
312
|
+
</div>
|
313
|
+
|
314
|
+
</div>
|
315
|
+
|
316
|
+
|
317
|
+
|
318
|
+
|
319
|
+
</div>
|
320
|
+
|
321
|
+
|
322
|
+
<div id="method-i-print_to_flat" class="method-detail ">
|
323
|
+
|
324
|
+
<div class="method-heading">
|
325
|
+
<span class="method-name">print_to_flat</span><span
|
326
|
+
class="method-args">(options)</span>
|
327
|
+
|
328
|
+
<span class="method-click-advice">click to toggle source</span>
|
329
|
+
|
330
|
+
</div>
|
331
|
+
|
332
|
+
|
333
|
+
<div class="method-description">
|
334
|
+
|
335
|
+
|
336
|
+
|
337
|
+
|
338
|
+
|
339
|
+
|
340
|
+
<div class="method-source-code" id="print_to_flat-source">
|
341
|
+
<pre><span class="ruby-comment"># File lib/ruby-prof/printers/multi_printer.rb, line 69</span>
|
342
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">print_to_flat</span>(<span class="ruby-identifier">options</span>)
|
343
|
+
<span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">flat_profile</span>, <span class="ruby-string">"w"</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span>
|
344
|
+
<span class="ruby-ivar">@flat_printer</span>.<span class="ruby-identifier">print</span>(<span class="ruby-identifier">f</span>, <span class="ruby-identifier">options</span>)
|
261
345
|
<span class="ruby-keyword">end</span>
|
346
|
+
<span class="ruby-keyword">end</span></pre>
|
347
|
+
</div>
|
348
|
+
|
349
|
+
</div>
|
350
|
+
|
351
|
+
|
352
|
+
|
353
|
+
|
354
|
+
</div>
|
355
|
+
|
356
|
+
|
357
|
+
<div id="method-i-print_to_graph" class="method-detail ">
|
358
|
+
|
359
|
+
<div class="method-heading">
|
360
|
+
<span class="method-name">print_to_graph</span><span
|
361
|
+
class="method-args">(options)</span>
|
362
|
+
|
363
|
+
<span class="method-click-advice">click to toggle source</span>
|
364
|
+
|
365
|
+
</div>
|
366
|
+
|
262
367
|
|
368
|
+
<div class="method-description">
|
369
|
+
|
370
|
+
|
371
|
+
|
372
|
+
|
373
|
+
|
374
|
+
|
375
|
+
<div class="method-source-code" id="print_to_graph-source">
|
376
|
+
<pre><span class="ruby-comment"># File lib/ruby-prof/printers/multi_printer.rb, line 59</span>
|
377
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">print_to_graph</span>(<span class="ruby-identifier">options</span>)
|
263
378
|
<span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">graph_profile</span>, <span class="ruby-string">"w"</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span>
|
264
379
|
<span class="ruby-ivar">@graph_printer</span>.<span class="ruby-identifier">print</span>(<span class="ruby-identifier">f</span>, <span class="ruby-identifier">options</span>)
|
265
380
|
<span class="ruby-keyword">end</span>
|
381
|
+
<span class="ruby-keyword">end</span></pre>
|
382
|
+
</div>
|
383
|
+
|
384
|
+
</div>
|
266
385
|
|
267
|
-
|
386
|
+
|
268
387
|
|
269
|
-
|
270
|
-
|
388
|
+
|
389
|
+
</div>
|
390
|
+
|
391
|
+
|
392
|
+
<div id="method-i-print_to_stack" class="method-detail ">
|
393
|
+
|
394
|
+
<div class="method-heading">
|
395
|
+
<span class="method-name">print_to_stack</span><span
|
396
|
+
class="method-args">(options)</span>
|
397
|
+
|
398
|
+
<span class="method-click-advice">click to toggle source</span>
|
399
|
+
|
400
|
+
</div>
|
401
|
+
|
402
|
+
|
403
|
+
<div class="method-description">
|
404
|
+
|
405
|
+
|
406
|
+
|
407
|
+
|
408
|
+
|
409
|
+
|
410
|
+
<div class="method-source-code" id="print_to_stack-source">
|
411
|
+
<pre><span class="ruby-comment"># File lib/ruby-prof/printers/multi_printer.rb, line 53</span>
|
412
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">print_to_stack</span>(<span class="ruby-identifier">options</span>)
|
413
|
+
<span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">stack_profile</span>, <span class="ruby-string">"w"</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span>
|
414
|
+
<span class="ruby-ivar">@stack_printer</span>.<span class="ruby-identifier">print</span>(<span class="ruby-identifier">f</span>, <span class="ruby-identifier">options</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-value">:graph</span> =<span class="ruby-operator">></span> <span class="ruby-node">"#{@profile}.graph.html"</span>))
|
271
415
|
<span class="ruby-keyword">end</span>
|
272
416
|
<span class="ruby-keyword">end</span></pre>
|
273
417
|
</div>
|
@@ -277,6 +421,39 @@ pofile file, defaults to “profile”.</p>
|
|
277
421
|
|
278
422
|
|
279
423
|
|
424
|
+
</div>
|
425
|
+
|
426
|
+
|
427
|
+
<div id="method-i-print_to_tree" class="method-detail ">
|
428
|
+
|
429
|
+
<div class="method-heading">
|
430
|
+
<span class="method-name">print_to_tree</span><span
|
431
|
+
class="method-args">(options)</span>
|
432
|
+
|
433
|
+
<span class="method-click-advice">click to toggle source</span>
|
434
|
+
|
435
|
+
</div>
|
436
|
+
|
437
|
+
|
438
|
+
<div class="method-description">
|
439
|
+
|
440
|
+
|
441
|
+
|
442
|
+
|
443
|
+
|
444
|
+
|
445
|
+
<div class="method-source-code" id="print_to_tree-source">
|
446
|
+
<pre><span class="ruby-comment"># File lib/ruby-prof/printers/multi_printer.rb, line 65</span>
|
447
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">print_to_tree</span>(<span class="ruby-identifier">options</span>)
|
448
|
+
<span class="ruby-ivar">@tree_printer</span>.<span class="ruby-identifier">print</span>(<span class="ruby-identifier">options</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-value">:path</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@directory</span>, <span class="ruby-value">:profile</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@profile</span>))
|
449
|
+
<span class="ruby-keyword">end</span></pre>
|
450
|
+
</div>
|
451
|
+
|
452
|
+
</div>
|
453
|
+
|
454
|
+
|
455
|
+
|
456
|
+
|
280
457
|
</div>
|
281
458
|
|
282
459
|
|
@@ -299,7 +476,7 @@ pofile file, defaults to “profile”.</p>
|
|
299
476
|
|
300
477
|
|
301
478
|
<div class="method-source-code" id="stack_profile-source">
|
302
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/printers/multi_printer.rb, line
|
479
|
+
<pre><span class="ruby-comment"># File lib/ruby-prof/printers/multi_printer.rb, line 34</span>
|
303
480
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">stack_profile</span>
|
304
481
|
<span class="ruby-node">"#{@directory}/#{@profile}.stack.html"</span>
|
305
482
|
<span class="ruby-keyword">end</span></pre>
|
@@ -332,7 +509,7 @@ pofile file, defaults to “profile”.</p>
|
|
332
509
|
|
333
510
|
|
334
511
|
<div class="method-source-code" id="tree_profile-source">
|
335
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/printers/multi_printer.rb, line
|
512
|
+
<pre><span class="ruby-comment"># File lib/ruby-prof/printers/multi_printer.rb, line 44</span>
|
336
513
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">tree_profile</span>
|
337
514
|
<span class="ruby-node">"#{@directory}/#{@profile}.callgrind.out.#{$$}"</span>
|
338
515
|
<span class="ruby-keyword">end</span></pre>
|
@@ -343,6 +520,43 @@ pofile file, defaults to “profile”.</p>
|
|
343
520
|
|
344
521
|
|
345
522
|
|
523
|
+
</div>
|
524
|
+
|
525
|
+
|
526
|
+
<div id="method-i-validate_print_params" class="method-detail ">
|
527
|
+
|
528
|
+
<div class="method-heading">
|
529
|
+
<span class="method-name">validate_print_params</span><span
|
530
|
+
class="method-args">(options)</span>
|
531
|
+
|
532
|
+
<span class="method-click-advice">click to toggle source</span>
|
533
|
+
|
534
|
+
</div>
|
535
|
+
|
536
|
+
|
537
|
+
<div class="method-description">
|
538
|
+
|
539
|
+
|
540
|
+
|
541
|
+
|
542
|
+
|
543
|
+
|
544
|
+
<div class="method-source-code" id="validate_print_params-source">
|
545
|
+
<pre><span class="ruby-comment"># File lib/ruby-prof/printers/multi_printer.rb, line 75</span>
|
546
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">validate_print_params</span>(<span class="ruby-identifier">options</span>)
|
547
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">IO</span>)
|
548
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">"#{self.class.name}#print cannot print to IO objects"</span>
|
549
|
+
<span class="ruby-keyword">elsif</span> <span class="ruby-operator">!</span><span class="ruby-identifier">options</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>)
|
550
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">"#{self.class.name}#print requires an options hash"</span>
|
551
|
+
<span class="ruby-keyword">end</span>
|
552
|
+
<span class="ruby-keyword">end</span></pre>
|
553
|
+
</div>
|
554
|
+
|
555
|
+
</div>
|
556
|
+
|
557
|
+
|
558
|
+
|
559
|
+
|
346
560
|
</div>
|
347
561
|
|
348
562
|
|
@@ -354,7 +568,7 @@ pofile file, defaults to “profile”.</p>
|
|
354
568
|
|
355
569
|
<footer id="validator-badges" role="contentinfo">
|
356
570
|
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
357
|
-
<p>Generated by <a href="
|
571
|
+
<p>Generated by <a href="https://rdoc.github.io/rdoc">RDoc</a> 5.1.0.
|
358
572
|
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
359
573
|
</footer>
|
360
574
|
|
data/doc/RubyProf/Profile.html
CHANGED
@@ -8,6 +8,7 @@
|
|
8
8
|
|
9
9
|
<script type="text/javascript">
|
10
10
|
var rdoc_rel_prefix = "../";
|
11
|
+
var index_rel_prefix = "../";
|
11
12
|
</script>
|
12
13
|
|
13
14
|
<script src="../js/jquery.js"></script>
|
@@ -62,7 +63,18 @@
|
|
62
63
|
|
63
64
|
</div>
|
64
65
|
|
65
|
-
|
66
|
+
<div id="includes-section" class="nav-section">
|
67
|
+
<h3>Included Modules</h3>
|
68
|
+
|
69
|
+
<ul class="link-list">
|
70
|
+
|
71
|
+
|
72
|
+
<li><a class="include" href="Profile/LegacyMethodElimination.html">RubyProf::Profile::LegacyMethodElimination</a>
|
73
|
+
|
74
|
+
|
75
|
+
</ul>
|
76
|
+
</div>
|
77
|
+
|
66
78
|
|
67
79
|
<!-- Method Quickref -->
|
68
80
|
<div id="method-list-section" class="nav-section">
|
@@ -74,13 +86,19 @@
|
|
74
86
|
|
75
87
|
<li ><a href="#method-c-profile">::profile</a>
|
76
88
|
|
77
|
-
<li ><a href="#method-i-
|
89
|
+
<li ><a href="#method-i-exclude_common_methods-21">#exclude_common_methods!</a>
|
90
|
+
|
91
|
+
<li ><a href="#method-i-exclude_method-21">#exclude_method!</a>
|
92
|
+
|
93
|
+
<li ><a href="#method-i-exclude_methods-21">#exclude_methods!</a>
|
94
|
+
|
95
|
+
<li ><a href="#method-i-exclude_singleton_methods-21">#exclude_singleton_methods!</a>
|
78
96
|
|
79
97
|
<li ><a href="#method-i-pause">#pause</a>
|
80
98
|
|
81
99
|
<li ><a href="#method-i-paused-3F">#paused?</a>
|
82
100
|
|
83
|
-
<li ><a href="#method-i-
|
101
|
+
<li ><a href="#method-i-profile">#profile</a>
|
84
102
|
|
85
103
|
<li ><a href="#method-i-resume">#resume</a>
|
86
104
|
|
@@ -180,6 +198,7 @@ prof_initialize(int argc, VALUE *argv, VALUE self)
|
|
180
198
|
VALUE exclude_threads = Qnil;
|
181
199
|
VALUE include_threads = Qnil;
|
182
200
|
VALUE merge_fibers = Qnil;
|
201
|
+
VALUE exclude_common = Qnil;
|
183
202
|
int i;
|
184
203
|
|
185
204
|
switch (rb_scan_args(argc, argv, "02", &mode_or_options, &exclude_threads)) {
|
@@ -193,6 +212,7 @@ prof_initialize(int argc, VALUE *argv, VALUE self)
|
|
193
212
|
Check_Type(mode_or_options, T_HASH);
|
194
213
|
mode = rb_hash_aref(mode_or_options, ID2SYM(rb_intern("measure_mode")));
|
195
214
|
merge_fibers = rb_hash_aref(mode_or_options, ID2SYM(rb_intern("merge_fibers")));
|
215
|
+
exclude_common = rb_hash_aref(mode_or_options, ID2SYM(rb_intern("exclude_common")));
|
196
216
|
exclude_threads = rb_hash_aref(mode_or_options, ID2SYM(rb_intern("exclude_threads")));
|
197
217
|
include_threads = rb_hash_aref(mode_or_options, ID2SYM(rb_intern("include_threads")));
|
198
218
|
}
|
@@ -232,6 +252,10 @@ prof_initialize(int argc, VALUE *argv, VALUE self)
|
|
232
252
|
}
|
233
253
|
}
|
234
254
|
|
255
|
+
if (RTEST(exclude_common)) {
|
256
|
+
prof_exclude_common_methods(self);
|
257
|
+
}
|
258
|
+
|
235
259
|
return self;
|
236
260
|
}</pre>
|
237
261
|
</div>
|
@@ -276,7 +300,7 @@ href="Profile.html">RubyProf::Profile</a> object. Arguments are passed to
|
|
276
300
|
|
277
301
|
<div class="method-source-code" id="profile-source">
|
278
302
|
<pre>static VALUE
|
279
|
-
|
303
|
+
prof_profile_class(int argc, VALUE *argv, VALUE klass)
|
280
304
|
{
|
281
305
|
int result;
|
282
306
|
VALUE profile = rb_class_new_instance(argc, argv, cProfile);
|
@@ -308,11 +332,98 @@ prof_profile(int argc, VALUE *argv, VALUE klass)
|
|
308
332
|
</header>
|
309
333
|
|
310
334
|
|
311
|
-
<div id="method-i-
|
335
|
+
<div id="method-i-exclude_common_methods-21" class="method-detail ">
|
336
|
+
|
337
|
+
<div class="method-heading">
|
338
|
+
<span class="method-name">exclude_common_methods!</span><span
|
339
|
+
class="method-args">()</span>
|
340
|
+
|
341
|
+
<span class="method-click-advice">click to toggle source</span>
|
342
|
+
|
343
|
+
</div>
|
344
|
+
|
345
|
+
|
346
|
+
<div class="method-description">
|
347
|
+
|
348
|
+
<p>Hides methods that, when represented as a call graph, have extremely large
|
349
|
+
in and out degrees and make navigation impossible.</p>
|
350
|
+
|
351
|
+
|
352
|
+
|
353
|
+
|
354
|
+
<div class="method-source-code" id="exclude_common_methods-21-source">
|
355
|
+
<pre><span class="ruby-comment"># File lib/ruby-prof/profile.rb, line 11</span>
|
356
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">exclude_common_methods!</span>
|
357
|
+
<span class="ruby-constant">ExcludeCommonMethods</span>.<span class="ruby-identifier">apply!</span>(<span class="ruby-keyword">self</span>)
|
358
|
+
<span class="ruby-keyword">end</span></pre>
|
359
|
+
</div>
|
360
|
+
|
361
|
+
</div>
|
362
|
+
|
363
|
+
|
364
|
+
|
365
|
+
|
366
|
+
</div>
|
367
|
+
|
368
|
+
|
369
|
+
<div id="method-i-exclude_method-21" class="method-detail ">
|
370
|
+
|
371
|
+
<div class="method-heading">
|
372
|
+
<span class="method-name">exclude_method!</span><span
|
373
|
+
class="method-args">(p1, p2)</span>
|
374
|
+
|
375
|
+
<span class="method-click-advice">click to toggle source</span>
|
376
|
+
|
377
|
+
</div>
|
378
|
+
|
379
|
+
|
380
|
+
<div class="method-description">
|
381
|
+
|
382
|
+
|
383
|
+
|
384
|
+
|
385
|
+
|
386
|
+
|
387
|
+
<div class="method-source-code" id="exclude_method-21-source">
|
388
|
+
<pre>static VALUE
|
389
|
+
prof_exclude_method(VALUE self, VALUE klass, VALUE sym)
|
390
|
+
{
|
391
|
+
prof_profile_t* profile = prof_get_profile(self);
|
392
|
+
ID mid = SYM2ID(sym);
|
393
|
+
|
394
|
+
prof_method_key_t key;
|
395
|
+
prof_method_t *method;
|
396
|
+
|
397
|
+
if (profile->running == Qtrue)
|
398
|
+
{
|
399
|
+
rb_raise(rb_eRuntimeError, "RubyProf.start was already called");
|
400
|
+
}
|
401
|
+
|
402
|
+
method_key(&key, klass, mid);
|
403
|
+
method = method_table_lookup(profile->exclude_methods_tbl, &key);
|
404
|
+
|
405
|
+
if (!method) {
|
406
|
+
method = prof_method_create_excluded(klass, mid);
|
407
|
+
method_table_insert(profile->exclude_methods_tbl, method->key, method);
|
408
|
+
}
|
409
|
+
|
410
|
+
return self;
|
411
|
+
}</pre>
|
412
|
+
</div>
|
413
|
+
|
414
|
+
</div>
|
415
|
+
|
416
|
+
|
417
|
+
|
418
|
+
|
419
|
+
</div>
|
420
|
+
|
421
|
+
|
422
|
+
<div id="method-i-exclude_methods-21" class="method-detail ">
|
312
423
|
|
313
424
|
<div class="method-heading">
|
314
|
-
<span class="method-name">
|
315
|
-
class="method-args">(
|
425
|
+
<span class="method-name">exclude_methods!</span><span
|
426
|
+
class="method-args">(mod, *method_or_methods)</span>
|
316
427
|
|
317
428
|
<span class="method-click-advice">click to toggle source</span>
|
318
429
|
|
@@ -321,22 +432,50 @@ prof_profile(int argc, VALUE *argv, VALUE klass)
|
|
321
432
|
|
322
433
|
<div class="method-description">
|
323
434
|
|
324
|
-
|
325
|
-
callers. matchers can be a list of strings or regular expressions or the
|
326
|
-
name of a file containing regexps.</p>
|
435
|
+
|
327
436
|
|
328
437
|
|
329
438
|
|
330
439
|
|
331
|
-
<div class="method-source-code" id="
|
440
|
+
<div class="method-source-code" id="exclude_methods-21-source">
|
332
441
|
<pre><span class="ruby-comment"># File lib/ruby-prof/profile.rb, line 15</span>
|
333
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">
|
334
|
-
<span class="ruby-identifier">
|
335
|
-
|
336
|
-
<span class="ruby-identifier">threads</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">thread</span><span class="ruby-operator">|</span>
|
337
|
-
<span class="ruby-identifier">matchers</span>.<span class="ruby-identifier">each</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">matcher</span><span class="ruby-operator">|</span> <span class="ruby-identifier">eliminated</span>.<span class="ruby-identifier">concat</span>(<span class="ruby-identifier">eliminate_methods</span>(<span class="ruby-identifier">thread</span>.<span class="ruby-identifier">methods</span>, <span class="ruby-identifier">matcher</span>)) }
|
442
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">exclude_methods!</span>(<span class="ruby-identifier">mod</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">method_or_methods</span>)
|
443
|
+
[<span class="ruby-identifier">method_or_methods</span>].<span class="ruby-identifier">flatten</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">name</span><span class="ruby-operator">|</span>
|
444
|
+
<span class="ruby-identifier">exclude_method!</span>(<span class="ruby-identifier">mod</span>, <span class="ruby-identifier">name</span>)
|
338
445
|
<span class="ruby-keyword">end</span>
|
339
|
-
|
446
|
+
<span class="ruby-keyword">end</span></pre>
|
447
|
+
</div>
|
448
|
+
|
449
|
+
</div>
|
450
|
+
|
451
|
+
|
452
|
+
|
453
|
+
|
454
|
+
</div>
|
455
|
+
|
456
|
+
|
457
|
+
<div id="method-i-exclude_singleton_methods-21" class="method-detail ">
|
458
|
+
|
459
|
+
<div class="method-heading">
|
460
|
+
<span class="method-name">exclude_singleton_methods!</span><span
|
461
|
+
class="method-args">(mod, *method_or_methods)</span>
|
462
|
+
|
463
|
+
<span class="method-click-advice">click to toggle source</span>
|
464
|
+
|
465
|
+
</div>
|
466
|
+
|
467
|
+
|
468
|
+
<div class="method-description">
|
469
|
+
|
470
|
+
|
471
|
+
|
472
|
+
|
473
|
+
|
474
|
+
|
475
|
+
<div class="method-source-code" id="exclude_singleton_methods-21-source">
|
476
|
+
<pre><span class="ruby-comment"># File lib/ruby-prof/profile.rb, line 21</span>
|
477
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">exclude_singleton_methods!</span>(<span class="ruby-identifier">mod</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">method_or_methods</span>)
|
478
|
+
<span class="ruby-identifier">exclude_methods!</span>(<span class="ruby-identifier">mod</span>.<span class="ruby-identifier">singleton_class</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">method_or_methods</span>)
|
340
479
|
<span class="ruby-keyword">end</span></pre>
|
341
480
|
</div>
|
342
481
|
|
@@ -436,33 +575,42 @@ prof_paused(VALUE self)
|
|
436
575
|
</div>
|
437
576
|
|
438
577
|
|
439
|
-
<div id="method-i-
|
578
|
+
<div id="method-i-profile" class="method-detail ">
|
579
|
+
|
440
580
|
|
441
581
|
<div class="method-heading">
|
442
|
-
<span class="method-
|
443
|
-
|
582
|
+
<span class="method-callseq">
|
583
|
+
profile {block} → RubyProf::Result
|
584
|
+
</span>
|
444
585
|
|
445
586
|
<span class="method-click-advice">click to toggle source</span>
|
446
587
|
|
447
588
|
</div>
|
448
589
|
|
590
|
+
|
449
591
|
|
450
592
|
<div class="method-description">
|
451
593
|
|
452
|
-
<p>
|
453
|
-
results are returned to the user. Thus it provides a hook to do any
|
454
|
-
necessary post-processing on the call graph.</p>
|
594
|
+
<p>Profiles the specified block and returns a RubyProf::Result object.</p>
|
455
595
|
|
456
596
|
|
457
597
|
|
458
598
|
|
459
|
-
<div class="method-source-code" id="
|
460
|
-
<pre
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
599
|
+
<div class="method-source-code" id="profile-source">
|
600
|
+
<pre>static VALUE
|
601
|
+
prof_profile_object(VALUE self)
|
602
|
+
{
|
603
|
+
int result;
|
604
|
+
if (!rb_block_given_p())
|
605
|
+
{
|
606
|
+
rb_raise(rb_eArgError, "A block must be provided to the profile method.");
|
607
|
+
}
|
608
|
+
|
609
|
+
prof_start(self);
|
610
|
+
rb_protect(rb_yield, self, &result);
|
611
|
+
return prof_stop(self);
|
612
|
+
|
613
|
+
}</pre>
|
466
614
|
</div>
|
467
615
|
|
468
616
|
</div>
|
@@ -669,11 +817,11 @@ prof_stop(VALUE self)
|
|
669
817
|
{
|
670
818
|
rb_raise(rb_eRuntimeError, "RubyProf.start was not yet called");
|
671
819
|
}
|
672
|
-
|
673
|
-
prof_remove_hook();
|
820
|
+
|
821
|
+
prof_remove_hook(self);
|
674
822
|
|
675
823
|
/* close trace file if open */
|
676
|
-
if (trace_file != NULL)
|
824
|
+
if (trace_file != NULL)
|
677
825
|
{
|
678
826
|
if (trace_file !=stderr && trace_file != stdout)
|
679
827
|
{
|
@@ -685,7 +833,7 @@ prof_stop(VALUE self)
|
|
685
833
|
}
|
686
834
|
trace_file = NULL;
|
687
835
|
}
|
688
|
-
|
836
|
+
|
689
837
|
prof_pop_threads(profile);
|
690
838
|
|
691
839
|
/* Unset the last_thread_data (very important!)
|
@@ -693,9 +841,6 @@ prof_stop(VALUE self)
|
|
693
841
|
profile->running = profile->paused = Qfalse;
|
694
842
|
profile->last_thread_data = NULL;
|
695
843
|
|
696
|
-
/* Post process result */
|
697
|
-
rb_funcall(self, rb_intern("post_process") , 0);
|
698
|
-
|
699
844
|
return self;
|
700
845
|
}</pre>
|
701
846
|
</div>
|
@@ -713,7 +858,7 @@ prof_stop(VALUE self)
|
|
713
858
|
|
714
859
|
<div class="method-heading">
|
715
860
|
<span class="method-callseq">
|
716
|
-
threads →
|
861
|
+
threads → Array of RubyProf::Thread
|
717
862
|
</span>
|
718
863
|
|
719
864
|
<span class="method-click-advice">click to toggle source</span>
|
@@ -757,7 +902,7 @@ prof_threads(VALUE self)
|
|
757
902
|
|
758
903
|
<footer id="validator-badges" role="contentinfo">
|
759
904
|
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
760
|
-
<p>Generated by <a href="
|
905
|
+
<p>Generated by <a href="https://rdoc.github.io/rdoc">RDoc</a> 5.1.0.
|
761
906
|
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
762
907
|
</footer>
|
763
908
|
|