ruby-prof 0.15.5 → 0.15.6
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 +4 -1
- data/doc/RubyProf.html +5 -6
- data/doc/RubyProf/CallInfo.html +259 -11
- data/doc/RubyProf/CallInfoPrinter.html +2 -2
- data/doc/RubyProf/CallInfoVisitor.html +7 -9
- data/doc/RubyProf/DotPrinter.html +2 -2
- data/doc/RubyProf/GraphHtmlPrinter.html +62 -58
- data/doc/RubyProf/MethodInfo.html +230 -30
- data/doc/RubyProf/Profile.html +2 -53
- data/doc/RubyProf/Thread.html +108 -4
- data/doc/created.rid +11 -11
- data/doc/js/search_index.js +1 -1
- data/doc/js/search_index.js.gz +0 -0
- data/doc/table_of_contents.html +120 -50
- data/ext/ruby_prof/rp_call_info.h +1 -1
- data/lib/ruby-prof/call_info.rb +54 -2
- data/lib/ruby-prof/call_info_visitor.rb +10 -12
- data/lib/ruby-prof/method_info.rb +31 -17
- data/lib/ruby-prof/printers/call_info_printer.rb +2 -2
- data/lib/ruby-prof/printers/dot_printer.rb +27 -27
- data/lib/ruby-prof/printers/graph_html_printer.rb +62 -58
- data/lib/ruby-prof/printers/graph_printer.rb +4 -3
- data/lib/ruby-prof/profile.rb +1 -22
- data/lib/ruby-prof/thread.rb +15 -3
- data/lib/ruby-prof/version.rb +1 -1
- data/test/call_info_visitor_test.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2611a288f51e3e7d0a29f25930cefe6420b4a01e
|
4
|
+
data.tar.gz: a8cdc8375d6bfd6ba5455f87f8be3c8b438a387b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8a15d1854ee6028cd5f549a6376a1c48468e05d4f6dac0f5cd13209d88fd7fc0eab30fde4798a9e1f982c5e1bc0fd73145937e93265d4c0839731e8c53b46d2
|
7
|
+
data.tar.gz: bd0385167c33165e05a09d0a5f71b02fc4ecdf64290fbfded52c4df7de0ce71d786af7da4211bf38814ea3d801981f608be3a1b64fa49a702d83bedacbeb35ed
|
data/CHANGES
CHANGED
@@ -1,6 +1,9 @@
|
|
1
|
-
0.15.
|
1
|
+
0.15.6 (2015-02-22)
|
2
2
|
======================
|
3
3
|
* improved upon computing children time in graph printers
|
4
|
+
|
5
|
+
0.15.5 (2015-02-22)
|
6
|
+
======================
|
4
7
|
* changed output format of flat_printer_with_line_number
|
5
8
|
* support using multi printer from command line (Dov Murik)
|
6
9
|
|
data/doc/RubyProf.html
CHANGED
@@ -118,13 +118,12 @@
|
|
118
118
|
|
119
119
|
<section class="description">
|
120
120
|
|
121
|
-
<p>The call info visitor class does a depth-first traversal across a
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
:exit.</p>
|
121
|
+
<p>The call info visitor class does a depth-first traversal across a list of
|
122
|
+
method infos. At each call_info node, the visitor executes the block
|
123
|
+
provided in the visit method. The block is passed two parameters, the event
|
124
|
+
and the call_info instance. Event will be either :enter or :exit.</p>
|
126
125
|
|
127
|
-
<pre class="ruby"><span class="ruby-identifier">visitor</span> = <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">CallInfoVisitor</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">result</span>.<span class="ruby-identifier">threads</span>.<span class="ruby-identifier">first</span>)
|
126
|
+
<pre class="ruby"><span class="ruby-identifier">visitor</span> = <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">CallInfoVisitor</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">result</span>.<span class="ruby-identifier">threads</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">top_call_infos</span>)
|
128
127
|
|
129
128
|
<span class="ruby-identifier">method_names</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
|
130
129
|
|
data/doc/RubyProf/CallInfo.html
CHANGED
@@ -70,16 +70,28 @@
|
|
70
70
|
|
71
71
|
<ul class="link-list" role="directory">
|
72
72
|
|
73
|
+
<li ><a href="#method-c-roots_of">::roots_of</a>
|
74
|
+
|
73
75
|
<li ><a href="#method-i-call_sequence">#call_sequence</a>
|
74
76
|
|
75
77
|
<li ><a href="#method-i-children_time">#children_time</a>
|
76
78
|
|
79
|
+
<li ><a href="#method-i-descendent_of">#descendent_of</a>
|
80
|
+
|
81
|
+
<li ><a href="#method-i-detect_recursion">#detect_recursion</a>
|
82
|
+
|
77
83
|
<li ><a href="#method-i-eliminate-21">#eliminate!</a>
|
78
84
|
|
79
85
|
<li ><a href="#method-i-find_call">#find_call</a>
|
80
86
|
|
87
|
+
<li class="calls-super" ><a href="#method-i-inspect">#inspect</a>
|
88
|
+
|
81
89
|
<li ><a href="#method-i-merge_call_tree">#merge_call_tree</a>
|
82
90
|
|
91
|
+
<li ><a href="#method-i-non_recursive-3F">#non_recursive?</a>
|
92
|
+
|
93
|
+
<li ><a href="#method-i-recalc_recursion">#recalc_recursion</a>
|
94
|
+
|
83
95
|
<li ><a href="#method-i-root-3F">#root?</a>
|
84
96
|
|
85
97
|
<li ><a href="#method-i-stack">#stack</a>
|
@@ -121,12 +133,16 @@
|
|
121
133
|
<div id="attribute-i-recursive" class="method-detail">
|
122
134
|
<div class="method-heading attribute-method-heading">
|
123
135
|
<span class="method-name">recursive</span><span
|
124
|
-
class="attribute-access-type">[
|
136
|
+
class="attribute-access-type">[R]</span>
|
125
137
|
</div>
|
126
138
|
|
127
139
|
<div class="method-description">
|
128
140
|
|
129
|
-
|
141
|
+
<p>part of this class is defined in C code. it provides the following
|
142
|
+
attributes pertaining to tree structure: depth: tree level (0 == root)
|
143
|
+
parent: parent call info (can be nil) children: array of call info
|
144
|
+
children (can be empty) target: method info (containing an array of
|
145
|
+
call infos)</p>
|
130
146
|
|
131
147
|
</div>
|
132
148
|
</div>
|
@@ -135,6 +151,52 @@
|
|
135
151
|
|
136
152
|
|
137
153
|
|
154
|
+
<section id="public-class-5Buntitled-5D-method-details" class="method-section">
|
155
|
+
<header>
|
156
|
+
<h3>Public Class Methods</h3>
|
157
|
+
</header>
|
158
|
+
|
159
|
+
|
160
|
+
<div id="method-c-roots_of" class="method-detail ">
|
161
|
+
|
162
|
+
<div class="method-heading">
|
163
|
+
<span class="method-name">roots_of</span><span
|
164
|
+
class="method-args">(call_infos)</span>
|
165
|
+
|
166
|
+
<span class="method-click-advice">click to toggle source</span>
|
167
|
+
|
168
|
+
</div>
|
169
|
+
|
170
|
+
|
171
|
+
<div class="method-description">
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
<div class="method-source-code" id="roots_of-source">
|
179
|
+
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line 74</span>
|
180
|
+
<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>)
|
181
|
+
<span class="ruby-identifier">roots</span> = []
|
182
|
+
<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>
|
183
|
+
<span class="ruby-keyword">while</span> <span class="ruby-identifier">call_info</span> = <span class="ruby-identifier">sorted</span>.<span class="ruby-identifier">shift</span>
|
184
|
+
<span class="ruby-identifier">roots</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">call_info</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">sorted</span>.<span class="ruby-identifier">any?</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">p</span><span class="ruby-operator">|</span> <span class="ruby-identifier">call_info</span>.<span class="ruby-identifier">descendent_of</span>(<span class="ruby-identifier">p</span>)}
|
185
|
+
<span class="ruby-keyword">end</span>
|
186
|
+
<span class="ruby-identifier">roots</span>
|
187
|
+
<span class="ruby-keyword">end</span></pre>
|
188
|
+
</div>
|
189
|
+
|
190
|
+
</div>
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
</div>
|
196
|
+
|
197
|
+
|
198
|
+
</section>
|
199
|
+
|
138
200
|
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
139
201
|
<header>
|
140
202
|
<h3>Public Instance Methods</h3>
|
@@ -160,7 +222,7 @@
|
|
160
222
|
|
161
223
|
|
162
224
|
<div class="method-source-code" id="call_sequence-source">
|
163
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line
|
225
|
+
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line 56</span>
|
164
226
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">call_sequence</span>
|
165
227
|
<span class="ruby-ivar">@call_sequence</span> <span class="ruby-operator">||=</span> <span class="ruby-keyword">begin</span>
|
166
228
|
<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>)
|
@@ -195,7 +257,7 @@
|
|
195
257
|
|
196
258
|
|
197
259
|
<div class="method-source-code" id="children_time-source">
|
198
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line
|
260
|
+
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line 37</span>
|
199
261
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">children_time</span>
|
200
262
|
<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>
|
201
263
|
<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>
|
@@ -208,6 +270,82 @@
|
|
208
270
|
|
209
271
|
|
210
272
|
|
273
|
+
</div>
|
274
|
+
|
275
|
+
|
276
|
+
<div id="method-i-descendent_of" class="method-detail ">
|
277
|
+
|
278
|
+
<div class="method-heading">
|
279
|
+
<span class="method-name">descendent_of</span><span
|
280
|
+
class="method-args">(other)</span>
|
281
|
+
|
282
|
+
<span class="method-click-advice">click to toggle source</span>
|
283
|
+
|
284
|
+
</div>
|
285
|
+
|
286
|
+
|
287
|
+
<div class="method-description">
|
288
|
+
|
289
|
+
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
|
294
|
+
<div class="method-source-code" id="descendent_of-source">
|
295
|
+
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line 66</span>
|
296
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">descendent_of</span>(<span class="ruby-identifier">other</span>)
|
297
|
+
<span class="ruby-identifier">p</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">parent</span>
|
298
|
+
<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>
|
299
|
+
<span class="ruby-identifier">p</span> = <span class="ruby-identifier">p</span>.<span class="ruby-identifier">parent</span>
|
300
|
+
<span class="ruby-keyword">end</span>
|
301
|
+
<span class="ruby-identifier">p</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">other</span>
|
302
|
+
<span class="ruby-keyword">end</span></pre>
|
303
|
+
</div>
|
304
|
+
|
305
|
+
</div>
|
306
|
+
|
307
|
+
|
308
|
+
|
309
|
+
|
310
|
+
</div>
|
311
|
+
|
312
|
+
|
313
|
+
<div id="method-i-detect_recursion" class="method-detail ">
|
314
|
+
|
315
|
+
<div class="method-heading">
|
316
|
+
<span class="method-name">detect_recursion</span><span
|
317
|
+
class="method-args">(visited_methods = Hash.new(0))</span>
|
318
|
+
|
319
|
+
<span class="method-click-advice">click to toggle source</span>
|
320
|
+
|
321
|
+
</div>
|
322
|
+
|
323
|
+
|
324
|
+
<div class="method-description">
|
325
|
+
|
326
|
+
|
327
|
+
|
328
|
+
|
329
|
+
|
330
|
+
|
331
|
+
<div class="method-source-code" id="detect_recursion-source">
|
332
|
+
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line 17</span>
|
333
|
+
<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>))
|
334
|
+
<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>
|
335
|
+
<span class="ruby-ivar">@non_recursive</span> = <span class="ruby-keyword">true</span>
|
336
|
+
<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>
|
337
|
+
<span class="ruby-ivar">@non_recursive</span> = <span class="ruby-keyword">false</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">child</span>.<span class="ruby-identifier">detect_recursion</span>(<span class="ruby-identifier">visited_methods</span>)
|
338
|
+
<span class="ruby-keyword">end</span>
|
339
|
+
<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>
|
340
|
+
<span class="ruby-keyword">return</span> <span class="ruby-operator">!</span><span class="ruby-ivar">@non_recursive</span>
|
341
|
+
<span class="ruby-keyword">end</span></pre>
|
342
|
+
</div>
|
343
|
+
|
344
|
+
</div>
|
345
|
+
|
346
|
+
|
347
|
+
|
348
|
+
|
211
349
|
</div>
|
212
350
|
|
213
351
|
|
@@ -232,7 +370,7 @@ from both praent end self.</p>
|
|
232
370
|
|
233
371
|
|
234
372
|
<div class="method-source-code" id="eliminate-21-source">
|
235
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line
|
373
|
+
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line 94</span>
|
236
374
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">eliminate!</span>
|
237
375
|
<span class="ruby-comment"># puts "eliminating #{self}"</span>
|
238
376
|
<span class="ruby-keyword">return</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">parent</span>
|
@@ -281,7 +419,7 @@ and call infos x</p>
|
|
281
419
|
|
282
420
|
|
283
421
|
<div class="method-source-code" id="find_call-source">
|
284
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line
|
422
|
+
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line 114</span>
|
285
423
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">find_call</span>(<span class="ruby-identifier">other</span>)
|
286
424
|
<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> }
|
287
425
|
<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>
|
@@ -294,6 +432,44 @@ and call infos x</p>
|
|
294
432
|
|
295
433
|
|
296
434
|
|
435
|
+
</div>
|
436
|
+
|
437
|
+
|
438
|
+
<div id="method-i-inspect" class="method-detail ">
|
439
|
+
|
440
|
+
<div class="method-heading">
|
441
|
+
<span class="method-name">inspect</span><span
|
442
|
+
class="method-args">()</span>
|
443
|
+
|
444
|
+
<span class="method-click-advice">click to toggle source</span>
|
445
|
+
|
446
|
+
</div>
|
447
|
+
|
448
|
+
|
449
|
+
<div class="method-description">
|
450
|
+
|
451
|
+
|
452
|
+
|
453
|
+
|
454
|
+
<div class="method-calls-super">
|
455
|
+
Calls superclass method
|
456
|
+
|
457
|
+
</div>
|
458
|
+
|
459
|
+
|
460
|
+
|
461
|
+
<div class="method-source-code" id="inspect-source">
|
462
|
+
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line 87</span>
|
463
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">inspect</span>
|
464
|
+
<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>
|
465
|
+
<span class="ruby-keyword">end</span></pre>
|
466
|
+
</div>
|
467
|
+
|
468
|
+
</div>
|
469
|
+
|
470
|
+
|
471
|
+
|
472
|
+
|
297
473
|
</div>
|
298
474
|
|
299
475
|
|
@@ -317,7 +493,7 @@ merges children of other into children of self.</p>
|
|
317
493
|
|
318
494
|
|
319
495
|
<div class="method-source-code" id="merge_call_tree-source">
|
320
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line
|
496
|
+
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line 121</span>
|
321
497
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">merge_call_tree</span>(<span class="ruby-identifier">other</span>)
|
322
498
|
<span class="ruby-comment"># $stderr.puts "merging #{self}\nand #{other}"</span>
|
323
499
|
<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>
|
@@ -343,6 +519,78 @@ merges children of other into children of self.</p>
|
|
343
519
|
|
344
520
|
|
345
521
|
|
522
|
+
</div>
|
523
|
+
|
524
|
+
|
525
|
+
<div id="method-i-non_recursive-3F" class="method-detail ">
|
526
|
+
|
527
|
+
<div class="method-heading">
|
528
|
+
<span class="method-name">non_recursive?</span><span
|
529
|
+
class="method-args">()</span>
|
530
|
+
|
531
|
+
<span class="method-click-advice">click to toggle source</span>
|
532
|
+
|
533
|
+
</div>
|
534
|
+
|
535
|
+
|
536
|
+
<div class="method-description">
|
537
|
+
|
538
|
+
|
539
|
+
|
540
|
+
|
541
|
+
|
542
|
+
|
543
|
+
<div class="method-source-code" id="non_recursive-3F-source">
|
544
|
+
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line 13</span>
|
545
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">non_recursive?</span>
|
546
|
+
<span class="ruby-ivar">@non_recursive</span>
|
547
|
+
<span class="ruby-keyword">end</span></pre>
|
548
|
+
</div>
|
549
|
+
|
550
|
+
</div>
|
551
|
+
|
552
|
+
|
553
|
+
|
554
|
+
|
555
|
+
</div>
|
556
|
+
|
557
|
+
|
558
|
+
<div id="method-i-recalc_recursion" class="method-detail ">
|
559
|
+
|
560
|
+
<div class="method-heading">
|
561
|
+
<span class="method-name">recalc_recursion</span><span
|
562
|
+
class="method-args">(visited_methods = Hash.new(0))</span>
|
563
|
+
|
564
|
+
<span class="method-click-advice">click to toggle source</span>
|
565
|
+
|
566
|
+
</div>
|
567
|
+
|
568
|
+
|
569
|
+
<div class="method-description">
|
570
|
+
|
571
|
+
|
572
|
+
|
573
|
+
|
574
|
+
|
575
|
+
|
576
|
+
<div class="method-source-code" id="recalc_recursion-source">
|
577
|
+
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line 27</span>
|
578
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">recalc_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>))
|
579
|
+
<span class="ruby-keyword">return</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@non_recursive</span>
|
580
|
+
<span class="ruby-identifier">target</span>.<span class="ruby-identifier">clear_cached_values_which_depend_on_recursiveness</span>
|
581
|
+
<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>
|
582
|
+
<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>
|
583
|
+
<span class="ruby-identifier">child</span>.<span class="ruby-identifier">recalc_recursion</span>(<span class="ruby-identifier">visited_methods</span>)
|
584
|
+
<span class="ruby-keyword">end</span>
|
585
|
+
<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>
|
586
|
+
<span class="ruby-keyword">end</span></pre>
|
587
|
+
</div>
|
588
|
+
|
589
|
+
</div>
|
590
|
+
|
591
|
+
|
592
|
+
|
593
|
+
|
346
594
|
</div>
|
347
595
|
|
348
596
|
|
@@ -365,7 +613,7 @@ merges children of other into children of self.</p>
|
|
365
613
|
|
366
614
|
|
367
615
|
<div class="method-source-code" id="root-3F-source">
|
368
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line
|
616
|
+
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line 62</span>
|
369
617
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">root?</span>
|
370
618
|
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">parent</span>.<span class="ruby-identifier">nil?</span>
|
371
619
|
<span class="ruby-keyword">end</span></pre>
|
@@ -398,7 +646,7 @@ merges children of other into children of self.</p>
|
|
398
646
|
|
399
647
|
|
400
648
|
<div class="method-source-code" id="stack-source">
|
401
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line
|
649
|
+
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line 43</span>
|
402
650
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">stack</span>
|
403
651
|
<span class="ruby-ivar">@stack</span> <span class="ruby-operator">||=</span> <span class="ruby-keyword">begin</span>
|
404
652
|
<span class="ruby-identifier">methods</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
|
@@ -440,9 +688,9 @@ merges children of other into children of self.</p>
|
|
440
688
|
|
441
689
|
|
442
690
|
<div class="method-source-code" id="to_s-source">
|
443
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line
|
691
|
+
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line 83</span>
|
444
692
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">to_s</span>
|
445
|
-
<span class="ruby-node">"#{
|
693
|
+
<span class="ruby-node">"#{target.full_name} (c: #{called}, tt: #{total_time}, st: #{self_time}, ct: #{children_time})"</span>
|
446
694
|
<span class="ruby-keyword">end</span></pre>
|
447
695
|
</div>
|
448
696
|
|
@@ -76,8 +76,8 @@
|
|
76
76
|
<section class="description">
|
77
77
|
|
78
78
|
<p>Prints out the call graph based on <a href="CallInfo.html">CallInfo</a>
|
79
|
-
instances.
|
80
|
-
into
|
79
|
+
instances. This is mainly for debugging purposes as it provides access into
|
80
|
+
into RubyProf's internals.</p>
|
81
81
|
|
82
82
|
</section>
|
83
83
|
|
@@ -112,7 +112,7 @@
|
|
112
112
|
|
113
113
|
<div class="method-heading">
|
114
114
|
<span class="method-name">new</span><span
|
115
|
-
class="method-args">(
|
115
|
+
class="method-args">(call_infos)</span>
|
116
116
|
|
117
117
|
<span class="method-click-advice">click to toggle source</span>
|
118
118
|
|
@@ -127,9 +127,9 @@
|
|
127
127
|
|
128
128
|
|
129
129
|
<div class="method-source-code" id="new-source">
|
130
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info_visitor.rb, line
|
131
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">
|
132
|
-
<span class="ruby-ivar">@
|
130
|
+
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info_visitor.rb, line 20</span>
|
131
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">call_infos</span>)
|
132
|
+
<span class="ruby-ivar">@call_infos</span> = <span class="ruby-constant">CallInfo</span>.<span class="ruby-identifier">roots_of</span>(<span class="ruby-identifier">call_infos</span>)
|
133
133
|
<span class="ruby-keyword">end</span></pre>
|
134
134
|
</div>
|
135
135
|
|
@@ -168,12 +168,10 @@
|
|
168
168
|
|
169
169
|
|
170
170
|
<div class="method-source-code" id="visit-source">
|
171
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info_visitor.rb, line
|
171
|
+
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info_visitor.rb, line 24</span>
|
172
172
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">visit</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
173
|
-
<span class="ruby-ivar">@
|
174
|
-
<span class="ruby-identifier">
|
175
|
-
<span class="ruby-identifier">visit_call_info</span>(<span class="ruby-identifier">call_info</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
176
|
-
<span class="ruby-keyword">end</span>
|
173
|
+
<span class="ruby-ivar">@call_infos</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">call_info</span><span class="ruby-operator">|</span>
|
174
|
+
<span class="ruby-identifier">visit_call_info</span>(<span class="ruby-identifier">call_info</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
177
175
|
<span class="ruby-keyword">end</span>
|
178
176
|
<span class="ruby-keyword">end</span></pre>
|
179
177
|
</div>
|