ruby-prof 0.16.2 → 0.17.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 +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
data/doc/RubyProf.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>
|
@@ -56,7 +57,18 @@
|
|
56
57
|
|
57
58
|
|
58
59
|
|
60
|
+
<div id="extends-section" class="nav-section">
|
61
|
+
<h3>Extended With Modules</h3>
|
62
|
+
|
63
|
+
<ul class="link-list">
|
59
64
|
|
65
|
+
|
66
|
+
<li><a class="extend" href="RubyProf/DeprecationWarnings.html">RubyProf::DeprecationWarnings</a>
|
67
|
+
|
68
|
+
|
69
|
+
</ul>
|
70
|
+
</div>
|
71
|
+
|
60
72
|
<!-- Method Quickref -->
|
61
73
|
<div id="method-list-section" class="nav-section">
|
62
74
|
<h3>Methods</h3>
|
@@ -297,7 +309,7 @@ environment variable</p>
|
|
297
309
|
|
298
310
|
|
299
311
|
<div class="method-source-code" id="figure_measure_mode-source">
|
300
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof.rb, line
|
312
|
+
<pre><span class="ruby-comment"># File lib/ruby-prof.rb, line 45</span>
|
301
313
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">figure_measure_mode</span>
|
302
314
|
<span class="ruby-keyword">case</span> <span class="ruby-constant">ENV</span>[<span class="ruby-string">"RUBY_PROF_MEASURE_MODE"</span>]
|
303
315
|
<span class="ruby-keyword">when</span> <span class="ruby-string">"wall"</span>, <span class="ruby-string">"wall_time"</span>
|
@@ -956,7 +968,7 @@ requires a patched Ruby interpreter.*/</p>
|
|
956
968
|
|
957
969
|
<footer id="validator-badges" role="contentinfo">
|
958
970
|
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
959
|
-
<p>Generated by <a href="
|
971
|
+
<p>Generated by <a href="https://rdoc.github.io/rdoc">RDoc</a> 5.1.0.
|
960
972
|
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
961
973
|
</footer>
|
962
974
|
|
@@ -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,8 +71,12 @@
|
|
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
|
|
78
|
+
<li ><a href="#method-i-editor_uri">#editor_uri</a>
|
79
|
+
|
75
80
|
<li ><a href="#method-i-method_name">#method_name</a>
|
76
81
|
|
77
82
|
<li ><a href="#method-i-min_percent">#min_percent</a>
|
@@ -126,6 +131,39 @@
|
|
126
131
|
</header>
|
127
132
|
|
128
133
|
|
134
|
+
<div id="method-c-needs_dir-3F" class="method-detail ">
|
135
|
+
|
136
|
+
<div class="method-heading">
|
137
|
+
<span class="method-name">needs_dir?</span><span
|
138
|
+
class="method-args">()</span>
|
139
|
+
|
140
|
+
<span class="method-click-advice">click to toggle source</span>
|
141
|
+
|
142
|
+
</div>
|
143
|
+
|
144
|
+
|
145
|
+
<div class="method-description">
|
146
|
+
|
147
|
+
<p>whether this printer need a :path option pointing to a directory</p>
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
<div class="method-source-code" id="needs_dir-3F-source">
|
153
|
+
<pre><span class="ruby-comment"># File lib/ruby-prof/printers/abstract_printer.rb, line 98</span>
|
154
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">needs_dir?</span>
|
155
|
+
<span class="ruby-keyword">false</span>
|
156
|
+
<span class="ruby-keyword">end</span></pre>
|
157
|
+
</div>
|
158
|
+
|
159
|
+
</div>
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
</div>
|
165
|
+
|
166
|
+
|
129
167
|
<div id="method-c-new" class="method-detail ">
|
130
168
|
|
131
169
|
<div class="method-heading">
|
@@ -170,6 +208,44 @@
|
|
170
208
|
</header>
|
171
209
|
|
172
210
|
|
211
|
+
<div id="method-i-editor_uri" class="method-detail ">
|
212
|
+
|
213
|
+
<div class="method-heading">
|
214
|
+
<span class="method-name">editor_uri</span><span
|
215
|
+
class="method-args">()</span>
|
216
|
+
|
217
|
+
<span class="method-click-advice">click to toggle source</span>
|
218
|
+
|
219
|
+
</div>
|
220
|
+
|
221
|
+
|
222
|
+
<div class="method-description">
|
223
|
+
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
<div class="method-source-code" id="editor_uri-source">
|
230
|
+
<pre><span class="ruby-comment"># File lib/ruby-prof/printers/abstract_printer.rb, line 47</span>
|
231
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">editor_uri</span>
|
232
|
+
<span class="ruby-identifier">default_uri</span> = <span class="ruby-keyword">if</span> <span class="ruby-constant">RUBY_PLATFORM</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/darwin/</span> <span class="ruby-operator">&&</span> <span class="ruby-operator">!</span><span class="ruby-constant">ENV</span>[<span class="ruby-string">'RUBY_PROF_EDITOR_URI'</span>]
|
233
|
+
<span class="ruby-string">'txmt'</span>
|
234
|
+
<span class="ruby-keyword">else</span>
|
235
|
+
<span class="ruby-keyword">false</span>
|
236
|
+
<span class="ruby-keyword">end</span>
|
237
|
+
<span class="ruby-constant">ENV</span>[<span class="ruby-string">'RUBY_PROF_EDITOR_URI'</span>] <span class="ruby-operator">||</span> <span class="ruby-ivar">@options</span>[<span class="ruby-value">:editor_uri</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">default_uri</span>
|
238
|
+
<span class="ruby-keyword">end</span></pre>
|
239
|
+
</div>
|
240
|
+
|
241
|
+
</div>
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
|
246
|
+
</div>
|
247
|
+
|
248
|
+
|
173
249
|
<div id="method-i-method_name" class="method-detail ">
|
174
250
|
|
175
251
|
<div class="method-heading">
|
@@ -189,7 +265,7 @@
|
|
189
265
|
|
190
266
|
|
191
267
|
<div class="method-source-code" id="method_name-source">
|
192
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/printers/abstract_printer.rb, line
|
268
|
+
<pre><span class="ruby-comment"># File lib/ruby-prof/printers/abstract_printer.rb, line 57</span>
|
193
269
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">method_name</span>(<span class="ruby-identifier">method</span>)
|
194
270
|
<span class="ruby-identifier">name</span> = <span class="ruby-identifier">method</span>.<span class="ruby-identifier">full_name</span>
|
195
271
|
<span class="ruby-keyword">if</span> <span class="ruby-identifier">print_file</span>
|
@@ -226,7 +302,7 @@
|
|
226
302
|
|
227
303
|
|
228
304
|
<div class="method-source-code" id="min_percent-source">
|
229
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/printers/abstract_printer.rb, line
|
305
|
+
<pre><span class="ruby-comment"># File lib/ruby-prof/printers/abstract_printer.rb, line 35</span>
|
230
306
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">min_percent</span>
|
231
307
|
<span class="ruby-ivar">@options</span>[<span class="ruby-value">:min_percent</span>] <span class="ruby-operator">||</span> <span class="ruby-value">0</span>
|
232
308
|
<span class="ruby-keyword">end</span></pre>
|
@@ -267,7 +343,7 @@ options.</p>
|
|
267
343
|
|
268
344
|
|
269
345
|
<div class="method-source-code" id="print-source">
|
270
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/printers/abstract_printer.rb, line
|
346
|
+
<pre><span class="ruby-comment"># File lib/ruby-prof/printers/abstract_printer.rb, line 73</span>
|
271
347
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">print</span>(<span class="ruby-identifier">output</span> = <span class="ruby-constant">STDOUT</span>, <span class="ruby-identifier">options</span> = {})
|
272
348
|
<span class="ruby-ivar">@output</span> = <span class="ruby-identifier">output</span>
|
273
349
|
<span class="ruby-identifier">setup_options</span>(<span class="ruby-identifier">options</span>)
|
@@ -302,7 +378,7 @@ options.</p>
|
|
302
378
|
|
303
379
|
|
304
380
|
<div class="method-source-code" id="print_file-source">
|
305
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/printers/abstract_printer.rb, line
|
381
|
+
<pre><span class="ruby-comment"># File lib/ruby-prof/printers/abstract_printer.rb, line 39</span>
|
306
382
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">print_file</span>
|
307
383
|
<span class="ruby-ivar">@options</span>[<span class="ruby-value">:print_file</span>] <span class="ruby-operator">||</span> <span class="ruby-keyword">false</span>
|
308
384
|
<span class="ruby-keyword">end</span></pre>
|
@@ -335,7 +411,7 @@ options.</p>
|
|
335
411
|
|
336
412
|
|
337
413
|
<div class="method-source-code" id="print_footer-source">
|
338
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/printers/abstract_printer.rb, line
|
414
|
+
<pre><span class="ruby-comment"># File lib/ruby-prof/printers/abstract_printer.rb, line 94</span>
|
339
415
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">print_footer</span>(<span class="ruby-identifier">thread</span>)
|
340
416
|
<span class="ruby-keyword">end</span></pre>
|
341
417
|
</div>
|
@@ -367,7 +443,7 @@ options.</p>
|
|
367
443
|
|
368
444
|
|
369
445
|
<div class="method-source-code" id="print_header-source">
|
370
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/printers/abstract_printer.rb, line
|
446
|
+
<pre><span class="ruby-comment"># File lib/ruby-prof/printers/abstract_printer.rb, line 91</span>
|
371
447
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">print_header</span>(<span class="ruby-identifier">thread</span>)
|
372
448
|
<span class="ruby-keyword">end</span></pre>
|
373
449
|
</div>
|
@@ -399,7 +475,7 @@ options.</p>
|
|
399
475
|
|
400
476
|
|
401
477
|
<div class="method-source-code" id="print_thread-source">
|
402
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/printers/abstract_printer.rb, line
|
478
|
+
<pre><span class="ruby-comment"># File lib/ruby-prof/printers/abstract_printer.rb, line 85</span>
|
403
479
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">print_thread</span>(<span class="ruby-identifier">thread</span>)
|
404
480
|
<span class="ruby-identifier">print_header</span>(<span class="ruby-identifier">thread</span>)
|
405
481
|
<span class="ruby-identifier">print_methods</span>(<span class="ruby-identifier">thread</span>)
|
@@ -434,7 +510,7 @@ options.</p>
|
|
434
510
|
|
435
511
|
|
436
512
|
<div class="method-source-code" id="print_threads-source">
|
437
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/printers/abstract_printer.rb, line
|
513
|
+
<pre><span class="ruby-comment"># File lib/ruby-prof/printers/abstract_printer.rb, line 79</span>
|
438
514
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">print_threads</span>
|
439
515
|
<span class="ruby-ivar">@result</span>.<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>
|
440
516
|
<span class="ruby-identifier">print_thread</span>(<span class="ruby-identifier">thread</span>)
|
@@ -479,13 +555,16 @@ options.</p>
|
|
479
555
|
:sort_method - Specifies method used for sorting method infos.
|
480
556
|
Available values are :total_time, :self_time,
|
481
557
|
:wait_time, :children_time
|
482
|
-
Default value is :total_time
|
558
|
+
Default value is :total_time
|
559
|
+
:editor_uri - Specifies editor uri scheme used for opening files
|
560
|
+
e.g. :atm or :mvim. For OS X default is :txmt.
|
561
|
+
Use RUBY_PROF_EDITOR_URI environment variable to overide.</pre>
|
483
562
|
|
484
563
|
|
485
564
|
|
486
565
|
|
487
566
|
<div class="method-source-code" id="setup_options-source">
|
488
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/printers/abstract_printer.rb, line
|
567
|
+
<pre><span class="ruby-comment"># File lib/ruby-prof/printers/abstract_printer.rb, line 31</span>
|
489
568
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">setup_options</span>(<span class="ruby-identifier">options</span> = {})
|
490
569
|
<span class="ruby-ivar">@options</span> = <span class="ruby-identifier">options</span>
|
491
570
|
<span class="ruby-keyword">end</span></pre>
|
@@ -518,7 +597,7 @@ options.</p>
|
|
518
597
|
|
519
598
|
|
520
599
|
<div class="method-source-code" id="sort_method-source">
|
521
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/printers/abstract_printer.rb, line
|
600
|
+
<pre><span class="ruby-comment"># File lib/ruby-prof/printers/abstract_printer.rb, line 43</span>
|
522
601
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">sort_method</span>
|
523
602
|
<span class="ruby-ivar">@options</span>[<span class="ruby-value">:sort_method</span>] <span class="ruby-operator">||</span> <span class="ruby-value">:total_time</span>
|
524
603
|
<span class="ruby-keyword">end</span></pre>
|
@@ -540,7 +619,7 @@ options.</p>
|
|
540
619
|
|
541
620
|
<footer id="validator-badges" role="contentinfo">
|
542
621
|
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
543
|
-
<p>Generated by <a href="
|
622
|
+
<p>Generated by <a href="https://rdoc.github.io/rdoc">RDoc</a> 5.1.0.
|
544
623
|
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
545
624
|
</footer>
|
546
625
|
|
@@ -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>
|
@@ -545,7 +546,7 @@
|
|
545
546
|
|
546
547
|
<footer id="validator-badges" role="contentinfo">
|
547
548
|
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
548
|
-
<p>Generated by <a href="
|
549
|
+
<p>Generated by <a href="https://rdoc.github.io/rdoc">RDoc</a> 5.1.0.
|
549
550
|
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
550
551
|
</footer>
|
551
552
|
|
data/doc/RubyProf/CallInfo.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>
|
@@ -78,8 +79,6 @@
|
|
78
79
|
|
79
80
|
<li ><a href="#method-i-descendent_of">#descendent_of</a>
|
80
81
|
|
81
|
-
<li ><a href="#method-i-detect_recursion">#detect_recursion</a>
|
82
|
-
|
83
82
|
<li ><a href="#method-i-eliminate-21">#eliminate!</a>
|
84
83
|
|
85
84
|
<li ><a href="#method-i-find_call">#find_call</a>
|
@@ -120,31 +119,6 @@
|
|
120
119
|
|
121
120
|
|
122
121
|
|
123
|
-
<section class="attribute-method-details" class="method-section">
|
124
|
-
<header>
|
125
|
-
<h3>Attributes</h3>
|
126
|
-
</header>
|
127
|
-
|
128
|
-
|
129
|
-
<div id="attribute-i-recursive" class="method-detail">
|
130
|
-
<div class="method-heading attribute-method-heading">
|
131
|
-
<span class="method-name">recursive</span><span
|
132
|
-
class="attribute-access-type">[R]</span>
|
133
|
-
</div>
|
134
|
-
|
135
|
-
<div class="method-description">
|
136
|
-
|
137
|
-
<p>part of this class is defined in C code. it provides the following
|
138
|
-
attributes pertaining to tree structure: depth: tree level (0 == root)
|
139
|
-
parent: parent call info (can be nil) children: array of call info
|
140
|
-
children (can be empty) target: method info (containing an array of
|
141
|
-
call infos)</p>
|
142
|
-
|
143
|
-
</div>
|
144
|
-
</div>
|
145
|
-
|
146
|
-
</section>
|
147
|
-
|
148
122
|
|
149
123
|
|
150
124
|
<section id="public-class-5Buntitled-5D-method-details" class="method-section">
|
@@ -172,7 +146,7 @@ call infos)</p>
|
|
172
146
|
|
173
147
|
|
174
148
|
<div class="method-source-code" id="roots_of-source">
|
175
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line
|
149
|
+
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line 48</span>
|
176
150
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">roots_of</span>(<span class="ruby-identifier">call_infos</span>)
|
177
151
|
<span class="ruby-identifier">roots</span> = []
|
178
152
|
<span class="ruby-identifier">sorted</span> = <span class="ruby-identifier">call_infos</span>.<span class="ruby-identifier">sort_by</span>(<span class="ruby-operator">&</span><span class="ruby-value">:depth</span>).<span class="ruby-identifier">reverse</span>
|
@@ -218,7 +192,7 @@ call infos)</p>
|
|
218
192
|
|
219
193
|
|
220
194
|
<div class="method-source-code" id="call_sequence-source">
|
221
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line
|
195
|
+
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line 30</span>
|
222
196
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">call_sequence</span>
|
223
197
|
<span class="ruby-ivar">@call_sequence</span> <span class="ruby-operator">||=</span> <span class="ruby-keyword">begin</span>
|
224
198
|
<span class="ruby-identifier">stack</span>.<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">method</span><span class="ruby-operator">|</span> <span class="ruby-identifier">method</span>.<span class="ruby-identifier">full_name</span>}.<span class="ruby-identifier">join</span>(<span class="ruby-string">'->'</span>)
|
@@ -247,13 +221,17 @@ call infos)</p>
|
|
247
221
|
|
248
222
|
<div class="method-description">
|
249
223
|
|
250
|
-
|
224
|
+
<p>part of this class is defined in C code. it provides the following
|
225
|
+
attributes pertaining to tree structure: depth: tree level (0 == root)
|
226
|
+
parent: parent call info (can be nil) children: array of call info
|
227
|
+
children (can be empty) target: method info (containing an array of
|
228
|
+
call infos)</p>
|
251
229
|
|
252
230
|
|
253
231
|
|
254
232
|
|
255
233
|
<div class="method-source-code" id="children_time-source">
|
256
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line
|
234
|
+
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line 11</span>
|
257
235
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">children_time</span>
|
258
236
|
<span class="ruby-identifier">children</span>.<span class="ruby-identifier">inject</span>(<span class="ruby-value">0</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">sum</span>, <span class="ruby-identifier">call_info</span><span class="ruby-operator">|</span>
|
259
237
|
<span class="ruby-identifier">sum</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">call_info</span>.<span class="ruby-identifier">total_time</span>
|
@@ -288,7 +266,7 @@ call infos)</p>
|
|
288
266
|
|
289
267
|
|
290
268
|
<div class="method-source-code" id="descendent_of-source">
|
291
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line
|
269
|
+
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line 40</span>
|
292
270
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">descendent_of</span>(<span class="ruby-identifier">other</span>)
|
293
271
|
<span class="ruby-identifier">p</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">parent</span>
|
294
272
|
<span class="ruby-keyword">while</span> <span class="ruby-identifier">p</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">p</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">other</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">p</span>.<span class="ruby-identifier">depth</span> <span class="ruby-operator">></span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">depth</span>
|
@@ -303,44 +281,6 @@ call infos)</p>
|
|
303
281
|
|
304
282
|
|
305
283
|
|
306
|
-
</div>
|
307
|
-
|
308
|
-
|
309
|
-
<div id="method-i-detect_recursion" class="method-detail ">
|
310
|
-
|
311
|
-
<div class="method-heading">
|
312
|
-
<span class="method-name">detect_recursion</span><span
|
313
|
-
class="method-args">(visited_methods = Hash.new(0))</span>
|
314
|
-
|
315
|
-
<span class="method-click-advice">click to toggle source</span>
|
316
|
-
|
317
|
-
</div>
|
318
|
-
|
319
|
-
|
320
|
-
<div class="method-description">
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
<div class="method-source-code" id="detect_recursion-source">
|
328
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line 13</span>
|
329
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">detect_recursion</span>(<span class="ruby-identifier">visited_methods</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">0</span>))
|
330
|
-
<span class="ruby-ivar">@recursive</span> = (<span class="ruby-identifier">visited_methods</span>[<span class="ruby-identifier">target</span>] <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>) <span class="ruby-operator">></span> <span class="ruby-value">1</span>
|
331
|
-
<span class="ruby-identifier">children</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">child</span><span class="ruby-operator">|</span>
|
332
|
-
<span class="ruby-identifier">child</span>.<span class="ruby-identifier">detect_recursion</span>(<span class="ruby-identifier">visited_methods</span>)
|
333
|
-
<span class="ruby-keyword">end</span>
|
334
|
-
<span class="ruby-identifier">visited_methods</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">target</span>) <span class="ruby-keyword">if</span> (<span class="ruby-identifier">visited_methods</span>[<span class="ruby-identifier">target</span>] <span class="ruby-operator">-=</span> <span class="ruby-value">1</span>) <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
|
335
|
-
<span class="ruby-keyword">return</span> <span class="ruby-ivar">@recursive</span>
|
336
|
-
<span class="ruby-keyword">end</span></pre>
|
337
|
-
</div>
|
338
|
-
|
339
|
-
</div>
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
284
|
</div>
|
345
285
|
|
346
286
|
|
@@ -365,7 +305,7 @@ from both praent end self.</p>
|
|
365
305
|
|
366
306
|
|
367
307
|
<div class="method-source-code" id="eliminate-21-source">
|
368
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line
|
308
|
+
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line 68</span>
|
369
309
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">eliminate!</span>
|
370
310
|
<span class="ruby-comment"># puts "eliminating #{self}"</span>
|
371
311
|
<span class="ruby-keyword">return</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">parent</span>
|
@@ -414,7 +354,7 @@ and call infos x</p>
|
|
414
354
|
|
415
355
|
|
416
356
|
<div class="method-source-code" id="find_call-source">
|
417
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line
|
357
|
+
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line 88</span>
|
418
358
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">find_call</span>(<span class="ruby-identifier">other</span>)
|
419
359
|
<span class="ruby-identifier">matching</span> = <span class="ruby-identifier">children</span>.<span class="ruby-identifier">select</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">kid</span><span class="ruby-operator">|</span> <span class="ruby-identifier">kid</span>.<span class="ruby-identifier">target</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">target</span> }
|
420
360
|
<span class="ruby-identifier">raise</span> <span class="ruby-string">"inconsistent call tree"</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">matching</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator"><=</span> <span class="ruby-value">1</span>
|
@@ -454,7 +394,7 @@ and call infos x</p>
|
|
454
394
|
|
455
395
|
|
456
396
|
<div class="method-source-code" id="inspect-source">
|
457
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line
|
397
|
+
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line 61</span>
|
458
398
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">inspect</span>
|
459
399
|
<span class="ruby-keyword">super</span> <span class="ruby-operator">+</span> <span class="ruby-node">"(#{target.full_name}, d: #{depth}, c: #{called}, tt: #{total_time}, st: #{self_time}, ct: #{children_time})"</span>
|
460
400
|
<span class="ruby-keyword">end</span></pre>
|
@@ -488,7 +428,7 @@ merges children of other into children of self.</p>
|
|
488
428
|
|
489
429
|
|
490
430
|
<div class="method-source-code" id="merge_call_tree-source">
|
491
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line
|
431
|
+
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line 95</span>
|
492
432
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">merge_call_tree</span>(<span class="ruby-identifier">other</span>)
|
493
433
|
<span class="ruby-comment"># $stderr.puts "merging #{self}\nand #{other}"</span>
|
494
434
|
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">called</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">called</span>
|
@@ -536,7 +476,7 @@ merges children of other into children of self.</p>
|
|
536
476
|
|
537
477
|
|
538
478
|
<div class="method-source-code" id="root-3F-source">
|
539
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line
|
479
|
+
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line 36</span>
|
540
480
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">root?</span>
|
541
481
|
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">parent</span>.<span class="ruby-identifier">nil?</span>
|
542
482
|
<span class="ruby-keyword">end</span></pre>
|
@@ -569,7 +509,7 @@ merges children of other into children of self.</p>
|
|
569
509
|
|
570
510
|
|
571
511
|
<div class="method-source-code" id="stack-source">
|
572
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line
|
512
|
+
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line 17</span>
|
573
513
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">stack</span>
|
574
514
|
<span class="ruby-ivar">@stack</span> <span class="ruby-operator">||=</span> <span class="ruby-keyword">begin</span>
|
575
515
|
<span class="ruby-identifier">methods</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
|
@@ -611,7 +551,7 @@ merges children of other into children of self.</p>
|
|
611
551
|
|
612
552
|
|
613
553
|
<div class="method-source-code" id="to_s-source">
|
614
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line
|
554
|
+
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line 57</span>
|
615
555
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">to_s</span>
|
616
556
|
<span class="ruby-node">"#{target.full_name} (c: #{called}, tt: #{total_time}, st: #{self_time}, ct: #{children_time})"</span>
|
617
557
|
<span class="ruby-keyword">end</span></pre>
|
@@ -633,7 +573,7 @@ merges children of other into children of self.</p>
|
|
633
573
|
|
634
574
|
<footer id="validator-badges" role="contentinfo">
|
635
575
|
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
636
|
-
<p>Generated by <a href="
|
576
|
+
<p>Generated by <a href="https://rdoc.github.io/rdoc">RDoc</a> 5.1.0.
|
637
577
|
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
638
578
|
</footer>
|
639
579
|
|