ruby-prof 0.15.7 → 0.15.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES +5 -0
- data/doc/created.rid +4 -4
- data/doc/js/search_index.js.gz +0 -0
- data/examples/graph.dot +53 -75
- data/examples/multi.flat.txt +21 -21
- data/examples/multi.graph.html +693 -839
- data/examples/multi.grind.dat +93 -173
- data/examples/multi.stack.html +411 -437
- data/examples/stack.html +411 -437
- data/lib/ruby-prof/assets/call_stack_printer.css.html +117 -0
- data/lib/ruby-prof/assets/call_stack_printer.js.html +385 -0
- data/lib/ruby-prof/assets/call_stack_printer.png +0 -0
- data/lib/ruby-prof/printers/flat_printer.rb +1 -1
- data/lib/ruby-prof/printers/graph_html_printer.rb +43 -48
- data/lib/ruby-prof/version.rb +1 -1
- data/ruby-prof.gemspec +1 -1
- data/test/measure_memory_test.rb +5 -3
- data/test/printers_test.rb +1 -1
- metadata +5 -58
- data/doc/LICENSE.html +0 -114
- data/doc/README_rdoc.html +0 -592
- data/doc/Rack.html +0 -95
- data/doc/Rack/RubyProf.html +0 -264
- data/doc/RubyProf.html +0 -961
- data/doc/RubyProf/AbstractPrinter.html +0 -546
- data/doc/RubyProf/AggregateCallInfo.html +0 -537
- data/doc/RubyProf/CallInfo.html +0 -716
- data/doc/RubyProf/CallInfoPrinter.html +0 -120
- data/doc/RubyProf/CallInfoVisitor.html +0 -198
- data/doc/RubyProf/CallStackPrinter.html +0 -1121
- data/doc/RubyProf/CallTreePrinter.html +0 -359
- data/doc/RubyProf/Cmd.html +0 -631
- data/doc/RubyProf/DotPrinter.html +0 -257
- data/doc/RubyProf/FlatPrinter.html +0 -163
- data/doc/RubyProf/FlatPrinterWithLineNumbers.html +0 -208
- data/doc/RubyProf/GraphHtmlPrinter.html +0 -579
- data/doc/RubyProf/GraphPrinter.html +0 -139
- data/doc/RubyProf/MethodInfo.html +0 -885
- data/doc/RubyProf/MultiPrinter.html +0 -358
- data/doc/RubyProf/Profile.html +0 -713
- data/doc/RubyProf/ProfileTask.html +0 -490
- data/doc/RubyProf/Thread.html +0 -303
- data/doc/examples/flat_txt.html +0 -149
- data/doc/examples/graph_html.html +0 -850
- data/doc/examples/graph_txt.html +0 -274
- data/doc/images/add.png +0 -0
- data/doc/images/arrow_up.png +0 -0
- data/doc/images/brick.png +0 -0
- data/doc/images/brick_link.png +0 -0
- data/doc/images/bug.png +0 -0
- data/doc/images/bullet_black.png +0 -0
- data/doc/images/bullet_toggle_minus.png +0 -0
- data/doc/images/bullet_toggle_plus.png +0 -0
- data/doc/images/date.png +0 -0
- data/doc/images/delete.png +0 -0
- data/doc/images/find.png +0 -0
- data/doc/images/macFFBgHack.png +0 -0
- data/doc/images/package.png +0 -0
- data/doc/images/page_green.png +0 -0
- data/doc/images/page_white_text.png +0 -0
- data/doc/images/page_white_width.png +0 -0
- data/doc/images/plugin.png +0 -0
- data/doc/images/ruby.png +0 -0
- data/doc/images/tag_blue.png +0 -0
- data/doc/images/tag_green.png +0 -0
- data/doc/images/transparent.png +0 -0
- data/doc/images/wrench.png +0 -0
- data/doc/images/wrench_orange.png +0 -0
- data/doc/images/zoom.png +0 -0
- data/doc/index.html +0 -618
- data/doc/table_of_contents.html +0 -934
- data/examples/empty.png +0 -0
- data/examples/graph.png +0 -0
- data/examples/minus.png +0 -0
- data/examples/plus.png +0 -0
data/doc/RubyProf/CallInfo.html
DELETED
@@ -1,716 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
|
3
|
-
<html>
|
4
|
-
<head>
|
5
|
-
<meta charset="UTF-8">
|
6
|
-
|
7
|
-
<title>class RubyProf::CallInfo - ruby-prof</title>
|
8
|
-
|
9
|
-
<script type="text/javascript">
|
10
|
-
var rdoc_rel_prefix = "../";
|
11
|
-
</script>
|
12
|
-
|
13
|
-
<script src="../js/jquery.js"></script>
|
14
|
-
<script src="../js/darkfish.js"></script>
|
15
|
-
|
16
|
-
<link href="../css/fonts.css" rel="stylesheet">
|
17
|
-
<link href="../css/rdoc.css" rel="stylesheet">
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
<body id="top" role="document" class="class">
|
22
|
-
<nav role="navigation">
|
23
|
-
<div id="project-navigation">
|
24
|
-
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
25
|
-
<h2>
|
26
|
-
<a href="../index.html" rel="home">Home</a>
|
27
|
-
</h2>
|
28
|
-
|
29
|
-
<div id="table-of-contents-navigation">
|
30
|
-
<a href="../table_of_contents.html#pages">Pages</a>
|
31
|
-
<a href="../table_of_contents.html#classes">Classes</a>
|
32
|
-
<a href="../table_of_contents.html#methods">Methods</a>
|
33
|
-
</div>
|
34
|
-
</div>
|
35
|
-
|
36
|
-
<div id="search-section" role="search" class="project-section initially-hidden">
|
37
|
-
<form action="#" method="get" accept-charset="utf-8">
|
38
|
-
<div id="search-field-wrapper">
|
39
|
-
<input id="search-field" role="combobox" aria-label="Search"
|
40
|
-
aria-autocomplete="list" aria-controls="search-results"
|
41
|
-
type="text" name="search" placeholder="Search" spellcheck="false"
|
42
|
-
title="Type to search, Up and Down to navigate, Enter to load">
|
43
|
-
</div>
|
44
|
-
|
45
|
-
<ul id="search-results" aria-label="Search Results"
|
46
|
-
aria-busy="false" aria-expanded="false"
|
47
|
-
aria-atomic="false" class="initially-hidden"></ul>
|
48
|
-
</form>
|
49
|
-
</div>
|
50
|
-
|
51
|
-
</div>
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
<div id="class-metadata">
|
56
|
-
|
57
|
-
<div id="parent-class-section" class="nav-section">
|
58
|
-
<h3>Parent</h3>
|
59
|
-
|
60
|
-
|
61
|
-
<p class="link">Object
|
62
|
-
|
63
|
-
</div>
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
<!-- Method Quickref -->
|
68
|
-
<div id="method-list-section" class="nav-section">
|
69
|
-
<h3>Methods</h3>
|
70
|
-
|
71
|
-
<ul class="link-list" role="directory">
|
72
|
-
|
73
|
-
<li ><a href="#method-c-roots_of">::roots_of</a>
|
74
|
-
|
75
|
-
<li ><a href="#method-i-call_sequence">#call_sequence</a>
|
76
|
-
|
77
|
-
<li ><a href="#method-i-children_time">#children_time</a>
|
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
|
-
|
83
|
-
<li ><a href="#method-i-eliminate-21">#eliminate!</a>
|
84
|
-
|
85
|
-
<li ><a href="#method-i-find_call">#find_call</a>
|
86
|
-
|
87
|
-
<li class="calls-super" ><a href="#method-i-inspect">#inspect</a>
|
88
|
-
|
89
|
-
<li ><a href="#method-i-merge_call_tree">#merge_call_tree</a>
|
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
|
-
|
95
|
-
<li ><a href="#method-i-root-3F">#root?</a>
|
96
|
-
|
97
|
-
<li ><a href="#method-i-stack">#stack</a>
|
98
|
-
|
99
|
-
<li ><a href="#method-i-to_s">#to_s</a>
|
100
|
-
|
101
|
-
</ul>
|
102
|
-
</div>
|
103
|
-
|
104
|
-
</div>
|
105
|
-
</nav>
|
106
|
-
|
107
|
-
<main role="main" aria-labelledby="class-RubyProf::CallInfo">
|
108
|
-
<h1 id="class-RubyProf::CallInfo" class="class">
|
109
|
-
class RubyProf::CallInfo
|
110
|
-
</h1>
|
111
|
-
|
112
|
-
<section class="description">
|
113
|
-
|
114
|
-
</section>
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
<section id="5Buntitled-5D" class="documentation-section">
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
<section class="attribute-method-details" class="method-section">
|
128
|
-
<header>
|
129
|
-
<h3>Attributes</h3>
|
130
|
-
</header>
|
131
|
-
|
132
|
-
|
133
|
-
<div id="attribute-i-recursive" class="method-detail">
|
134
|
-
<div class="method-heading attribute-method-heading">
|
135
|
-
<span class="method-name">recursive</span><span
|
136
|
-
class="attribute-access-type">[R]</span>
|
137
|
-
</div>
|
138
|
-
|
139
|
-
<div class="method-description">
|
140
|
-
|
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>
|
146
|
-
|
147
|
-
</div>
|
148
|
-
</div>
|
149
|
-
|
150
|
-
</section>
|
151
|
-
|
152
|
-
|
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
|
-
|
200
|
-
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
201
|
-
<header>
|
202
|
-
<h3>Public Instance Methods</h3>
|
203
|
-
</header>
|
204
|
-
|
205
|
-
|
206
|
-
<div id="method-i-call_sequence" class="method-detail ">
|
207
|
-
|
208
|
-
<div class="method-heading">
|
209
|
-
<span class="method-name">call_sequence</span><span
|
210
|
-
class="method-args">()</span>
|
211
|
-
|
212
|
-
<span class="method-click-advice">click to toggle source</span>
|
213
|
-
|
214
|
-
</div>
|
215
|
-
|
216
|
-
|
217
|
-
<div class="method-description">
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
<div class="method-source-code" id="call_sequence-source">
|
225
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line 56</span>
|
226
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">call_sequence</span>
|
227
|
-
<span class="ruby-ivar">@call_sequence</span> <span class="ruby-operator">||=</span> <span class="ruby-keyword">begin</span>
|
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>)
|
229
|
-
<span class="ruby-keyword">end</span>
|
230
|
-
<span class="ruby-keyword">end</span></pre>
|
231
|
-
</div>
|
232
|
-
|
233
|
-
</div>
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
</div>
|
239
|
-
|
240
|
-
|
241
|
-
<div id="method-i-children_time" class="method-detail ">
|
242
|
-
|
243
|
-
<div class="method-heading">
|
244
|
-
<span class="method-name">children_time</span><span
|
245
|
-
class="method-args">()</span>
|
246
|
-
|
247
|
-
<span class="method-click-advice">click to toggle source</span>
|
248
|
-
|
249
|
-
</div>
|
250
|
-
|
251
|
-
|
252
|
-
<div class="method-description">
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
<div class="method-source-code" id="children_time-source">
|
260
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line 37</span>
|
261
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">children_time</span>
|
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>
|
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>
|
264
|
-
<span class="ruby-keyword">end</span>
|
265
|
-
<span class="ruby-keyword">end</span></pre>
|
266
|
-
</div>
|
267
|
-
|
268
|
-
</div>
|
269
|
-
|
270
|
-
|
271
|
-
|
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
|
-
|
349
|
-
</div>
|
350
|
-
|
351
|
-
|
352
|
-
<div id="method-i-eliminate-21" class="method-detail ">
|
353
|
-
|
354
|
-
<div class="method-heading">
|
355
|
-
<span class="method-name">eliminate!</span><span
|
356
|
-
class="method-args">()</span>
|
357
|
-
|
358
|
-
<span class="method-click-advice">click to toggle source</span>
|
359
|
-
|
360
|
-
</div>
|
361
|
-
|
362
|
-
|
363
|
-
<div class="method-description">
|
364
|
-
|
365
|
-
<p>eliminate call info from the call tree. adds self and wait time to parent
|
366
|
-
and attaches called methods to parent. merges call trees for methods called
|
367
|
-
from both praent end self.</p>
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
<div class="method-source-code" id="eliminate-21-source">
|
373
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line 94</span>
|
374
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">eliminate!</span>
|
375
|
-
<span class="ruby-comment"># puts "eliminating #{self}"</span>
|
376
|
-
<span class="ruby-keyword">return</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">parent</span>
|
377
|
-
<span class="ruby-identifier">parent</span>.<span class="ruby-identifier">add_self_time</span>(<span class="ruby-keyword">self</span>)
|
378
|
-
<span class="ruby-identifier">parent</span>.<span class="ruby-identifier">add_wait_time</span>(<span class="ruby-keyword">self</span>)
|
379
|
-
<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">kid</span><span class="ruby-operator">|</span>
|
380
|
-
<span class="ruby-keyword">if</span> <span class="ruby-identifier">call</span> = <span class="ruby-identifier">parent</span>.<span class="ruby-identifier">find_call</span>(<span class="ruby-identifier">kid</span>)
|
381
|
-
<span class="ruby-identifier">call</span>.<span class="ruby-identifier">merge_call_tree</span>(<span class="ruby-identifier">kid</span>)
|
382
|
-
<span class="ruby-keyword">else</span>
|
383
|
-
<span class="ruby-identifier">parent</span>.<span class="ruby-identifier">children</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">kid</span>
|
384
|
-
<span class="ruby-comment"># $stderr.puts "setting parent of #{kid}\nto #{parent}"</span>
|
385
|
-
<span class="ruby-identifier">kid</span>.<span class="ruby-identifier">parent</span> = <span class="ruby-identifier">parent</span>
|
386
|
-
<span class="ruby-keyword">end</span>
|
387
|
-
<span class="ruby-keyword">end</span>
|
388
|
-
<span class="ruby-identifier">parent</span>.<span class="ruby-identifier">children</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-keyword">self</span>)
|
389
|
-
<span class="ruby-keyword">end</span></pre>
|
390
|
-
</div>
|
391
|
-
|
392
|
-
</div>
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
</div>
|
398
|
-
|
399
|
-
|
400
|
-
<div id="method-i-find_call" class="method-detail ">
|
401
|
-
|
402
|
-
<div class="method-heading">
|
403
|
-
<span class="method-name">find_call</span><span
|
404
|
-
class="method-args">(other)</span>
|
405
|
-
|
406
|
-
<span class="method-click-advice">click to toggle source</span>
|
407
|
-
|
408
|
-
</div>
|
409
|
-
|
410
|
-
|
411
|
-
<div class="method-description">
|
412
|
-
|
413
|
-
<p>find a specific call in list of children. returns nil if not found. note:
|
414
|
-
there can't be more than one child with a given target method. in other
|
415
|
-
words: x.children.grep{|y|y.target==m}.size <= 1 for all method infos m
|
416
|
-
and call infos x</p>
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
<div class="method-source-code" id="find_call-source">
|
422
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line 114</span>
|
423
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">find_call</span>(<span class="ruby-identifier">other</span>)
|
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> }
|
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>
|
426
|
-
<span class="ruby-identifier">matching</span>.<span class="ruby-identifier">first</span>
|
427
|
-
<span class="ruby-keyword">end</span></pre>
|
428
|
-
</div>
|
429
|
-
|
430
|
-
</div>
|
431
|
-
|
432
|
-
|
433
|
-
|
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
|
-
|
473
|
-
</div>
|
474
|
-
|
475
|
-
|
476
|
-
<div id="method-i-merge_call_tree" class="method-detail ">
|
477
|
-
|
478
|
-
<div class="method-heading">
|
479
|
-
<span class="method-name">merge_call_tree</span><span
|
480
|
-
class="method-args">(other)</span>
|
481
|
-
|
482
|
-
<span class="method-click-advice">click to toggle source</span>
|
483
|
-
|
484
|
-
</div>
|
485
|
-
|
486
|
-
|
487
|
-
<div class="method-description">
|
488
|
-
|
489
|
-
<p>merge two call trees. adds self, wait, and total time of other to self and
|
490
|
-
merges children of other into children of self.</p>
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
<div class="method-source-code" id="merge_call_tree-source">
|
496
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line 121</span>
|
497
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">merge_call_tree</span>(<span class="ruby-identifier">other</span>)
|
498
|
-
<span class="ruby-comment"># $stderr.puts "merging #{self}\nand #{other}"</span>
|
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>
|
500
|
-
<span class="ruby-identifier">add_self_time</span>(<span class="ruby-identifier">other</span>)
|
501
|
-
<span class="ruby-identifier">add_wait_time</span>(<span class="ruby-identifier">other</span>)
|
502
|
-
<span class="ruby-identifier">add_total_time</span>(<span class="ruby-identifier">other</span>)
|
503
|
-
<span class="ruby-identifier">other</span>.<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">other_kid</span><span class="ruby-operator">|</span>
|
504
|
-
<span class="ruby-keyword">if</span> <span class="ruby-identifier">kid</span> = <span class="ruby-identifier">find_call</span>(<span class="ruby-identifier">other_kid</span>)
|
505
|
-
<span class="ruby-comment"># $stderr.puts "merging kids"</span>
|
506
|
-
<span class="ruby-identifier">kid</span>.<span class="ruby-identifier">merge_call_tree</span>(<span class="ruby-identifier">other_kid</span>)
|
507
|
-
<span class="ruby-keyword">else</span>
|
508
|
-
<span class="ruby-identifier">other_kid</span>.<span class="ruby-identifier">parent</span> = <span class="ruby-keyword">self</span>
|
509
|
-
<span class="ruby-identifier">children</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">other_kid</span>
|
510
|
-
<span class="ruby-keyword">end</span>
|
511
|
-
<span class="ruby-keyword">end</span>
|
512
|
-
<span class="ruby-identifier">other</span>.<span class="ruby-identifier">children</span>.<span class="ruby-identifier">clear</span>
|
513
|
-
<span class="ruby-identifier">other</span>.<span class="ruby-identifier">target</span>.<span class="ruby-identifier">call_infos</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">other</span>)
|
514
|
-
<span class="ruby-keyword">end</span></pre>
|
515
|
-
</div>
|
516
|
-
|
517
|
-
</div>
|
518
|
-
|
519
|
-
|
520
|
-
|
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
|
-
|
594
|
-
</div>
|
595
|
-
|
596
|
-
|
597
|
-
<div id="method-i-root-3F" class="method-detail ">
|
598
|
-
|
599
|
-
<div class="method-heading">
|
600
|
-
<span class="method-name">root?</span><span
|
601
|
-
class="method-args">()</span>
|
602
|
-
|
603
|
-
<span class="method-click-advice">click to toggle source</span>
|
604
|
-
|
605
|
-
</div>
|
606
|
-
|
607
|
-
|
608
|
-
<div class="method-description">
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
<div class="method-source-code" id="root-3F-source">
|
616
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line 62</span>
|
617
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">root?</span>
|
618
|
-
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">parent</span>.<span class="ruby-identifier">nil?</span>
|
619
|
-
<span class="ruby-keyword">end</span></pre>
|
620
|
-
</div>
|
621
|
-
|
622
|
-
</div>
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
</div>
|
628
|
-
|
629
|
-
|
630
|
-
<div id="method-i-stack" class="method-detail ">
|
631
|
-
|
632
|
-
<div class="method-heading">
|
633
|
-
<span class="method-name">stack</span><span
|
634
|
-
class="method-args">()</span>
|
635
|
-
|
636
|
-
<span class="method-click-advice">click to toggle source</span>
|
637
|
-
|
638
|
-
</div>
|
639
|
-
|
640
|
-
|
641
|
-
<div class="method-description">
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
<div class="method-source-code" id="stack-source">
|
649
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line 43</span>
|
650
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">stack</span>
|
651
|
-
<span class="ruby-ivar">@stack</span> <span class="ruby-operator">||=</span> <span class="ruby-keyword">begin</span>
|
652
|
-
<span class="ruby-identifier">methods</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
|
653
|
-
<span class="ruby-identifier">call_info</span> = <span class="ruby-keyword">self</span>
|
654
|
-
|
655
|
-
<span class="ruby-keyword">while</span> <span class="ruby-identifier">call_info</span>
|
656
|
-
<span class="ruby-identifier">methods</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">call_info</span>.<span class="ruby-identifier">target</span>
|
657
|
-
<span class="ruby-identifier">call_info</span> = <span class="ruby-identifier">call_info</span>.<span class="ruby-identifier">parent</span>
|
658
|
-
<span class="ruby-keyword">end</span>
|
659
|
-
<span class="ruby-identifier">methods</span>.<span class="ruby-identifier">reverse</span>
|
660
|
-
<span class="ruby-keyword">end</span>
|
661
|
-
<span class="ruby-keyword">end</span></pre>
|
662
|
-
</div>
|
663
|
-
|
664
|
-
</div>
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
</div>
|
670
|
-
|
671
|
-
|
672
|
-
<div id="method-i-to_s" class="method-detail ">
|
673
|
-
|
674
|
-
<div class="method-heading">
|
675
|
-
<span class="method-name">to_s</span><span
|
676
|
-
class="method-args">()</span>
|
677
|
-
|
678
|
-
<span class="method-click-advice">click to toggle source</span>
|
679
|
-
|
680
|
-
</div>
|
681
|
-
|
682
|
-
|
683
|
-
<div class="method-description">
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
<div class="method-source-code" id="to_s-source">
|
691
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line 83</span>
|
692
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">to_s</span>
|
693
|
-
<span class="ruby-node">"#{target.full_name} (c: #{called}, tt: #{total_time}, st: #{self_time}, ct: #{children_time})"</span>
|
694
|
-
<span class="ruby-keyword">end</span></pre>
|
695
|
-
</div>
|
696
|
-
|
697
|
-
</div>
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
</div>
|
703
|
-
|
704
|
-
|
705
|
-
</section>
|
706
|
-
|
707
|
-
</section>
|
708
|
-
</main>
|
709
|
-
|
710
|
-
|
711
|
-
<footer id="validator-badges" role="contentinfo">
|
712
|
-
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
713
|
-
<p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.0.
|
714
|
-
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
715
|
-
</footer>
|
716
|
-
|