ruby-prof 0.17.0 → 0.18.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 +5 -5
- data/CHANGES +500 -482
- data/LICENSE +24 -24
- data/README.rdoc +487 -485
- data/Rakefile +113 -113
- data/bin/ruby-prof +345 -345
- data/bin/ruby-prof-check-trace +45 -45
- data/examples/flat.txt +50 -50
- data/examples/graph.dot +84 -84
- data/examples/graph.html +823 -823
- data/examples/graph.txt +139 -139
- data/examples/multi.flat.txt +23 -23
- data/examples/multi.graph.html +760 -760
- data/examples/multi.grind.dat +114 -114
- data/examples/multi.stack.html +547 -547
- data/examples/stack.html +547 -547
- data/ext/ruby_prof/extconf.rb +68 -68
- data/ext/ruby_prof/rp_call_info.c +425 -425
- data/ext/ruby_prof/rp_call_info.h +53 -53
- data/ext/ruby_prof/rp_measure.c +40 -40
- data/ext/ruby_prof/rp_measure.h +45 -45
- data/ext/ruby_prof/rp_measure_allocations.c +76 -76
- data/ext/ruby_prof/rp_measure_cpu_time.c +136 -136
- data/ext/ruby_prof/rp_measure_gc_runs.c +73 -73
- data/ext/ruby_prof/rp_measure_gc_time.c +60 -60
- data/ext/ruby_prof/rp_measure_memory.c +77 -77
- data/ext/ruby_prof/rp_measure_process_time.c +71 -71
- data/ext/ruby_prof/rp_measure_wall_time.c +45 -45
- data/ext/ruby_prof/rp_method.c +630 -636
- data/ext/ruby_prof/rp_method.h +75 -75
- data/ext/ruby_prof/rp_stack.c +173 -173
- data/ext/ruby_prof/rp_stack.h +63 -63
- data/ext/ruby_prof/rp_thread.c +277 -276
- data/ext/ruby_prof/rp_thread.h +27 -27
- data/ext/ruby_prof/ruby_prof.c +794 -774
- data/ext/ruby_prof/ruby_prof.h +60 -59
- data/ext/ruby_prof/vc/ruby_prof.sln +20 -21
- data/ext/ruby_prof/vc/{ruby_prof_20.vcxproj → ruby_prof.vcxproj} +31 -0
- data/lib/ruby-prof.rb +68 -68
- data/lib/ruby-prof/aggregate_call_info.rb +76 -76
- data/lib/ruby-prof/assets/call_stack_printer.css.html +116 -116
- data/lib/ruby-prof/assets/call_stack_printer.js.html +384 -384
- data/lib/ruby-prof/call_info.rb +115 -115
- data/lib/ruby-prof/call_info_visitor.rb +40 -40
- data/lib/ruby-prof/compatibility.rb +179 -178
- data/lib/ruby-prof/method_info.rb +121 -121
- data/lib/ruby-prof/printers/abstract_printer.rb +104 -103
- data/lib/ruby-prof/printers/call_info_printer.rb +41 -41
- data/lib/ruby-prof/printers/call_stack_printer.rb +265 -265
- data/lib/ruby-prof/printers/call_tree_printer.rb +143 -143
- data/lib/ruby-prof/printers/dot_printer.rb +132 -132
- data/lib/ruby-prof/printers/flat_printer.rb +70 -70
- data/lib/ruby-prof/printers/flat_printer_with_line_numbers.rb +83 -83
- data/lib/ruby-prof/printers/graph_html_printer.rb +249 -249
- data/lib/ruby-prof/printers/graph_printer.rb +116 -116
- data/lib/ruby-prof/printers/multi_printer.rb +84 -84
- data/lib/ruby-prof/profile.rb +26 -26
- data/lib/ruby-prof/profile/exclude_common_methods.rb +207 -201
- data/lib/ruby-prof/profile/legacy_method_elimination.rb +50 -49
- data/lib/ruby-prof/rack.rb +174 -174
- data/lib/ruby-prof/task.rb +147 -147
- data/lib/ruby-prof/thread.rb +35 -35
- data/lib/ruby-prof/version.rb +3 -3
- data/lib/unprof.rb +10 -10
- data/ruby-prof.gemspec +58 -58
- data/test/abstract_printer_test.rb +53 -0
- data/test/aggregate_test.rb +136 -136
- data/test/basic_test.rb +128 -128
- data/test/block_test.rb +74 -74
- data/test/call_info_test.rb +78 -78
- data/test/call_info_visitor_test.rb +31 -31
- data/test/duplicate_names_test.rb +32 -32
- data/test/dynamic_method_test.rb +55 -55
- data/test/enumerable_test.rb +21 -21
- data/test/exceptions_test.rb +24 -16
- data/test/exclude_methods_test.rb +146 -146
- data/test/exclude_threads_test.rb +53 -53
- data/test/fiber_test.rb +79 -79
- data/test/issue137_test.rb +63 -63
- data/test/line_number_test.rb +80 -80
- data/test/measure_allocations_test.rb +26 -26
- data/test/measure_cpu_time_test.rb +212 -213
- data/test/measure_gc_runs_test.rb +32 -32
- data/test/measure_gc_time_test.rb +36 -36
- data/test/measure_memory_test.rb +33 -33
- data/test/measure_process_time_test.rb +61 -63
- data/test/measure_wall_time_test.rb +255 -255
- data/test/method_elimination_test.rb +84 -84
- data/test/module_test.rb +45 -45
- data/test/multi_printer_test.rb +104 -104
- data/test/no_method_class_test.rb +15 -15
- data/test/pause_resume_test.rb +166 -166
- data/test/prime.rb +54 -54
- data/test/printers_test.rb +275 -275
- data/test/printing_recursive_graph_test.rb +127 -127
- data/test/rack_test.rb +157 -157
- data/test/recursive_test.rb +215 -215
- data/test/singleton_test.rb +38 -38
- data/test/stack_printer_test.rb +77 -78
- data/test/stack_test.rb +138 -138
- data/test/start_stop_test.rb +112 -112
- data/test/test_helper.rb +267 -275
- data/test/thread_test.rb +187 -187
- data/test/unique_call_path_test.rb +202 -202
- data/test/yarv_test.rb +55 -55
- metadata +17 -96
- data/doc/LICENSE.html +0 -115
- data/doc/README_rdoc.html +0 -637
- data/doc/Rack.html +0 -96
- data/doc/Rack/RubyProf.html +0 -233
- data/doc/Rack/RubyProf/RackProfiler.html +0 -343
- data/doc/RubyProf.html +0 -974
- data/doc/RubyProf/AbstractPrinter.html +0 -625
- data/doc/RubyProf/AggregateCallInfo.html +0 -552
- data/doc/RubyProf/CallInfo.html +0 -579
- data/doc/RubyProf/CallInfoPrinter.html +0 -121
- data/doc/RubyProf/CallInfoVisitor.html +0 -199
- data/doc/RubyProf/CallStackPrinter.html +0 -1127
- data/doc/RubyProf/CallTreePrinter.html +0 -725
- data/doc/RubyProf/Cmd.html +0 -637
- data/doc/RubyProf/DeprecationWarnings.html +0 -148
- data/doc/RubyProf/DotPrinter.html +0 -258
- data/doc/RubyProf/FlatPrinter.html +0 -164
- data/doc/RubyProf/FlatPrinterWithLineNumbers.html +0 -210
- data/doc/RubyProf/GraphHtmlPrinter.html +0 -558
- data/doc/RubyProf/GraphPrinter.html +0 -140
- data/doc/RubyProf/MethodInfo.html +0 -676
- data/doc/RubyProf/MultiPrinter.html +0 -574
- data/doc/RubyProf/Profile.html +0 -908
- data/doc/RubyProf/Profile/ExcludeCommonMethods.html +0 -411
- data/doc/RubyProf/Profile/LegacyMethodElimination.html +0 -158
- data/doc/RubyProf/ProfileTask.html +0 -491
- data/doc/RubyProf/Thread.html +0 -275
- data/doc/created.rid +0 -33
- data/doc/css/fonts.css +0 -167
- data/doc/css/rdoc.css +0 -590
- data/doc/examples/flat_txt.html +0 -139
- data/doc/examples/graph_html.html +0 -910
- data/doc/examples/graph_txt.html +0 -248
- data/doc/fonts/Lato-Light.ttf +0 -0
- data/doc/fonts/Lato-LightItalic.ttf +0 -0
- data/doc/fonts/Lato-Regular.ttf +0 -0
- data/doc/fonts/Lato-RegularItalic.ttf +0 -0
- data/doc/fonts/SourceCodePro-Bold.ttf +0 -0
- data/doc/fonts/SourceCodePro-Regular.ttf +0 -0
- 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/loadingAnimation.gif +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 -666
- data/doc/js/darkfish.js +0 -161
- data/doc/js/jquery.js +0 -4
- data/doc/js/navigation.js +0 -142
- data/doc/js/navigation.js.gz +0 -0
- data/doc/js/search.js +0 -109
- data/doc/js/search_index.js +0 -1
- data/doc/js/search_index.js.gz +0 -0
- data/doc/js/searcher.js +0 -229
- data/doc/js/searcher.js.gz +0 -0
- data/doc/table_of_contents.html +0 -1052
- data/examples/cachegrind.out.1 +0 -114
- data/examples/cachegrind.out.1.32313213 +0 -114
- data/ext/ruby_prof/vc/ruby_prof_18.vcxproj +0 -108
- data/ext/ruby_prof/vc/ruby_prof_19.vcxproj +0 -110
data/doc/RubyProf/CallInfo.html
DELETED
@@ -1,579 +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
|
-
var index_rel_prefix = "../";
|
12
|
-
</script>
|
13
|
-
|
14
|
-
<script src="../js/jquery.js"></script>
|
15
|
-
<script src="../js/darkfish.js"></script>
|
16
|
-
|
17
|
-
<link href="../css/fonts.css" rel="stylesheet">
|
18
|
-
<link href="../css/rdoc.css" rel="stylesheet">
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
<body id="top" role="document" class="class">
|
23
|
-
<nav role="navigation">
|
24
|
-
<div id="project-navigation">
|
25
|
-
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
26
|
-
<h2>
|
27
|
-
<a href="../index.html" rel="home">Home</a>
|
28
|
-
</h2>
|
29
|
-
|
30
|
-
<div id="table-of-contents-navigation">
|
31
|
-
<a href="../table_of_contents.html#pages">Pages</a>
|
32
|
-
<a href="../table_of_contents.html#classes">Classes</a>
|
33
|
-
<a href="../table_of_contents.html#methods">Methods</a>
|
34
|
-
</div>
|
35
|
-
</div>
|
36
|
-
|
37
|
-
<div id="search-section" role="search" class="project-section initially-hidden">
|
38
|
-
<form action="#" method="get" accept-charset="utf-8">
|
39
|
-
<div id="search-field-wrapper">
|
40
|
-
<input id="search-field" role="combobox" aria-label="Search"
|
41
|
-
aria-autocomplete="list" aria-controls="search-results"
|
42
|
-
type="text" name="search" placeholder="Search" spellcheck="false"
|
43
|
-
title="Type to search, Up and Down to navigate, Enter to load">
|
44
|
-
</div>
|
45
|
-
|
46
|
-
<ul id="search-results" aria-label="Search Results"
|
47
|
-
aria-busy="false" aria-expanded="false"
|
48
|
-
aria-atomic="false" class="initially-hidden"></ul>
|
49
|
-
</form>
|
50
|
-
</div>
|
51
|
-
|
52
|
-
</div>
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
<div id="class-metadata">
|
57
|
-
|
58
|
-
<div id="parent-class-section" class="nav-section">
|
59
|
-
<h3>Parent</h3>
|
60
|
-
|
61
|
-
|
62
|
-
<p class="link">Object
|
63
|
-
|
64
|
-
</div>
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
<!-- Method Quickref -->
|
69
|
-
<div id="method-list-section" class="nav-section">
|
70
|
-
<h3>Methods</h3>
|
71
|
-
|
72
|
-
<ul class="link-list" role="directory">
|
73
|
-
|
74
|
-
<li ><a href="#method-c-roots_of">::roots_of</a>
|
75
|
-
|
76
|
-
<li ><a href="#method-i-call_sequence">#call_sequence</a>
|
77
|
-
|
78
|
-
<li ><a href="#method-i-children_time">#children_time</a>
|
79
|
-
|
80
|
-
<li ><a href="#method-i-descendent_of">#descendent_of</a>
|
81
|
-
|
82
|
-
<li ><a href="#method-i-eliminate-21">#eliminate!</a>
|
83
|
-
|
84
|
-
<li ><a href="#method-i-find_call">#find_call</a>
|
85
|
-
|
86
|
-
<li class="calls-super" ><a href="#method-i-inspect">#inspect</a>
|
87
|
-
|
88
|
-
<li ><a href="#method-i-merge_call_tree">#merge_call_tree</a>
|
89
|
-
|
90
|
-
<li ><a href="#method-i-root-3F">#root?</a>
|
91
|
-
|
92
|
-
<li ><a href="#method-i-stack">#stack</a>
|
93
|
-
|
94
|
-
<li ><a href="#method-i-to_s">#to_s</a>
|
95
|
-
|
96
|
-
</ul>
|
97
|
-
</div>
|
98
|
-
|
99
|
-
</div>
|
100
|
-
</nav>
|
101
|
-
|
102
|
-
<main role="main" aria-labelledby="class-RubyProf::CallInfo">
|
103
|
-
<h1 id="class-RubyProf::CallInfo" class="class">
|
104
|
-
class RubyProf::CallInfo
|
105
|
-
</h1>
|
106
|
-
|
107
|
-
<section class="description">
|
108
|
-
|
109
|
-
</section>
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
<section id="5Buntitled-5D" class="documentation-section">
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
<section id="public-class-5Buntitled-5D-method-details" class="method-section">
|
125
|
-
<header>
|
126
|
-
<h3>Public Class Methods</h3>
|
127
|
-
</header>
|
128
|
-
|
129
|
-
|
130
|
-
<div id="method-c-roots_of" class="method-detail ">
|
131
|
-
|
132
|
-
<div class="method-heading">
|
133
|
-
<span class="method-name">roots_of</span><span
|
134
|
-
class="method-args">(call_infos)</span>
|
135
|
-
|
136
|
-
<span class="method-click-advice">click to toggle source</span>
|
137
|
-
|
138
|
-
</div>
|
139
|
-
|
140
|
-
|
141
|
-
<div class="method-description">
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
<div class="method-source-code" id="roots_of-source">
|
149
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line 48</span>
|
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>)
|
151
|
-
<span class="ruby-identifier">roots</span> = []
|
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>
|
153
|
-
<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>
|
154
|
-
<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>)}
|
155
|
-
<span class="ruby-keyword">end</span>
|
156
|
-
<span class="ruby-identifier">roots</span>
|
157
|
-
<span class="ruby-keyword">end</span></pre>
|
158
|
-
</div>
|
159
|
-
|
160
|
-
</div>
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
</div>
|
166
|
-
|
167
|
-
|
168
|
-
</section>
|
169
|
-
|
170
|
-
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
171
|
-
<header>
|
172
|
-
<h3>Public Instance Methods</h3>
|
173
|
-
</header>
|
174
|
-
|
175
|
-
|
176
|
-
<div id="method-i-call_sequence" class="method-detail ">
|
177
|
-
|
178
|
-
<div class="method-heading">
|
179
|
-
<span class="method-name">call_sequence</span><span
|
180
|
-
class="method-args">()</span>
|
181
|
-
|
182
|
-
<span class="method-click-advice">click to toggle source</span>
|
183
|
-
|
184
|
-
</div>
|
185
|
-
|
186
|
-
|
187
|
-
<div class="method-description">
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
<div class="method-source-code" id="call_sequence-source">
|
195
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line 30</span>
|
196
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">call_sequence</span>
|
197
|
-
<span class="ruby-ivar">@call_sequence</span> <span class="ruby-operator">||=</span> <span class="ruby-keyword">begin</span>
|
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>)
|
199
|
-
<span class="ruby-keyword">end</span>
|
200
|
-
<span class="ruby-keyword">end</span></pre>
|
201
|
-
</div>
|
202
|
-
|
203
|
-
</div>
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
</div>
|
209
|
-
|
210
|
-
|
211
|
-
<div id="method-i-children_time" class="method-detail ">
|
212
|
-
|
213
|
-
<div class="method-heading">
|
214
|
-
<span class="method-name">children_time</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
|
-
<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>
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
<div class="method-source-code" id="children_time-source">
|
234
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line 11</span>
|
235
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">children_time</span>
|
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>
|
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>
|
238
|
-
<span class="ruby-keyword">end</span>
|
239
|
-
<span class="ruby-keyword">end</span></pre>
|
240
|
-
</div>
|
241
|
-
|
242
|
-
</div>
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
</div>
|
248
|
-
|
249
|
-
|
250
|
-
<div id="method-i-descendent_of" class="method-detail ">
|
251
|
-
|
252
|
-
<div class="method-heading">
|
253
|
-
<span class="method-name">descendent_of</span><span
|
254
|
-
class="method-args">(other)</span>
|
255
|
-
|
256
|
-
<span class="method-click-advice">click to toggle source</span>
|
257
|
-
|
258
|
-
</div>
|
259
|
-
|
260
|
-
|
261
|
-
<div class="method-description">
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
<div class="method-source-code" id="descendent_of-source">
|
269
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line 40</span>
|
270
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">descendent_of</span>(<span class="ruby-identifier">other</span>)
|
271
|
-
<span class="ruby-identifier">p</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">parent</span>
|
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>
|
273
|
-
<span class="ruby-identifier">p</span> = <span class="ruby-identifier">p</span>.<span class="ruby-identifier">parent</span>
|
274
|
-
<span class="ruby-keyword">end</span>
|
275
|
-
<span class="ruby-identifier">p</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">other</span>
|
276
|
-
<span class="ruby-keyword">end</span></pre>
|
277
|
-
</div>
|
278
|
-
|
279
|
-
</div>
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
</div>
|
285
|
-
|
286
|
-
|
287
|
-
<div id="method-i-eliminate-21" class="method-detail ">
|
288
|
-
|
289
|
-
<div class="method-heading">
|
290
|
-
<span class="method-name">eliminate!</span><span
|
291
|
-
class="method-args">()</span>
|
292
|
-
|
293
|
-
<span class="method-click-advice">click to toggle source</span>
|
294
|
-
|
295
|
-
</div>
|
296
|
-
|
297
|
-
|
298
|
-
<div class="method-description">
|
299
|
-
|
300
|
-
<p>eliminate call info from the call tree. adds self and wait time to parent
|
301
|
-
and attaches called methods to parent. merges call trees for methods called
|
302
|
-
from both praent end self.</p>
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
<div class="method-source-code" id="eliminate-21-source">
|
308
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line 68</span>
|
309
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">eliminate!</span>
|
310
|
-
<span class="ruby-comment"># puts "eliminating #{self}"</span>
|
311
|
-
<span class="ruby-keyword">return</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">parent</span>
|
312
|
-
<span class="ruby-identifier">parent</span>.<span class="ruby-identifier">add_self_time</span>(<span class="ruby-keyword">self</span>)
|
313
|
-
<span class="ruby-identifier">parent</span>.<span class="ruby-identifier">add_wait_time</span>(<span class="ruby-keyword">self</span>)
|
314
|
-
<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>
|
315
|
-
<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>)
|
316
|
-
<span class="ruby-identifier">call</span>.<span class="ruby-identifier">merge_call_tree</span>(<span class="ruby-identifier">kid</span>)
|
317
|
-
<span class="ruby-keyword">else</span>
|
318
|
-
<span class="ruby-identifier">parent</span>.<span class="ruby-identifier">children</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">kid</span>
|
319
|
-
<span class="ruby-comment"># $stderr.puts "setting parent of #{kid}\nto #{parent}"</span>
|
320
|
-
<span class="ruby-identifier">kid</span>.<span class="ruby-identifier">parent</span> = <span class="ruby-identifier">parent</span>
|
321
|
-
<span class="ruby-keyword">end</span>
|
322
|
-
<span class="ruby-keyword">end</span>
|
323
|
-
<span class="ruby-identifier">parent</span>.<span class="ruby-identifier">children</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-keyword">self</span>)
|
324
|
-
<span class="ruby-keyword">end</span></pre>
|
325
|
-
</div>
|
326
|
-
|
327
|
-
</div>
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
</div>
|
333
|
-
|
334
|
-
|
335
|
-
<div id="method-i-find_call" class="method-detail ">
|
336
|
-
|
337
|
-
<div class="method-heading">
|
338
|
-
<span class="method-name">find_call</span><span
|
339
|
-
class="method-args">(other)</span>
|
340
|
-
|
341
|
-
<span class="method-click-advice">click to toggle source</span>
|
342
|
-
|
343
|
-
</div>
|
344
|
-
|
345
|
-
|
346
|
-
<div class="method-description">
|
347
|
-
|
348
|
-
<p>find a specific call in list of children. returns nil if not found. note:
|
349
|
-
there can't be more than one child with a given target method. in other
|
350
|
-
words: x.children.grep{|y|y.target==m}.size <= 1 for all method infos m
|
351
|
-
and call infos x</p>
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
<div class="method-source-code" id="find_call-source">
|
357
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line 88</span>
|
358
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">find_call</span>(<span class="ruby-identifier">other</span>)
|
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> }
|
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>
|
361
|
-
<span class="ruby-identifier">matching</span>.<span class="ruby-identifier">first</span>
|
362
|
-
<span class="ruby-keyword">end</span></pre>
|
363
|
-
</div>
|
364
|
-
|
365
|
-
</div>
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
</div>
|
371
|
-
|
372
|
-
|
373
|
-
<div id="method-i-inspect" class="method-detail ">
|
374
|
-
|
375
|
-
<div class="method-heading">
|
376
|
-
<span class="method-name">inspect</span><span
|
377
|
-
class="method-args">()</span>
|
378
|
-
|
379
|
-
<span class="method-click-advice">click to toggle source</span>
|
380
|
-
|
381
|
-
</div>
|
382
|
-
|
383
|
-
|
384
|
-
<div class="method-description">
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
<div class="method-calls-super">
|
390
|
-
Calls superclass method
|
391
|
-
|
392
|
-
</div>
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
<div class="method-source-code" id="inspect-source">
|
397
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line 61</span>
|
398
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">inspect</span>
|
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>
|
400
|
-
<span class="ruby-keyword">end</span></pre>
|
401
|
-
</div>
|
402
|
-
|
403
|
-
</div>
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
</div>
|
409
|
-
|
410
|
-
|
411
|
-
<div id="method-i-merge_call_tree" class="method-detail ">
|
412
|
-
|
413
|
-
<div class="method-heading">
|
414
|
-
<span class="method-name">merge_call_tree</span><span
|
415
|
-
class="method-args">(other)</span>
|
416
|
-
|
417
|
-
<span class="method-click-advice">click to toggle source</span>
|
418
|
-
|
419
|
-
</div>
|
420
|
-
|
421
|
-
|
422
|
-
<div class="method-description">
|
423
|
-
|
424
|
-
<p>merge two call trees. adds self, wait, and total time of other to self and
|
425
|
-
merges children of other into children of self.</p>
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
<div class="method-source-code" id="merge_call_tree-source">
|
431
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line 95</span>
|
432
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">merge_call_tree</span>(<span class="ruby-identifier">other</span>)
|
433
|
-
<span class="ruby-comment"># $stderr.puts "merging #{self}\nand #{other}"</span>
|
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>
|
435
|
-
<span class="ruby-identifier">add_self_time</span>(<span class="ruby-identifier">other</span>)
|
436
|
-
<span class="ruby-identifier">add_wait_time</span>(<span class="ruby-identifier">other</span>)
|
437
|
-
<span class="ruby-identifier">add_total_time</span>(<span class="ruby-identifier">other</span>)
|
438
|
-
<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>
|
439
|
-
<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>)
|
440
|
-
<span class="ruby-comment"># $stderr.puts "merging kids"</span>
|
441
|
-
<span class="ruby-identifier">kid</span>.<span class="ruby-identifier">merge_call_tree</span>(<span class="ruby-identifier">other_kid</span>)
|
442
|
-
<span class="ruby-keyword">else</span>
|
443
|
-
<span class="ruby-identifier">other_kid</span>.<span class="ruby-identifier">parent</span> = <span class="ruby-keyword">self</span>
|
444
|
-
<span class="ruby-identifier">children</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">other_kid</span>
|
445
|
-
<span class="ruby-keyword">end</span>
|
446
|
-
<span class="ruby-keyword">end</span>
|
447
|
-
<span class="ruby-identifier">other</span>.<span class="ruby-identifier">children</span>.<span class="ruby-identifier">clear</span>
|
448
|
-
<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>)
|
449
|
-
<span class="ruby-keyword">end</span></pre>
|
450
|
-
</div>
|
451
|
-
|
452
|
-
</div>
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
</div>
|
458
|
-
|
459
|
-
|
460
|
-
<div id="method-i-root-3F" class="method-detail ">
|
461
|
-
|
462
|
-
<div class="method-heading">
|
463
|
-
<span class="method-name">root?</span><span
|
464
|
-
class="method-args">()</span>
|
465
|
-
|
466
|
-
<span class="method-click-advice">click to toggle source</span>
|
467
|
-
|
468
|
-
</div>
|
469
|
-
|
470
|
-
|
471
|
-
<div class="method-description">
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
<div class="method-source-code" id="root-3F-source">
|
479
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line 36</span>
|
480
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">root?</span>
|
481
|
-
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">parent</span>.<span class="ruby-identifier">nil?</span>
|
482
|
-
<span class="ruby-keyword">end</span></pre>
|
483
|
-
</div>
|
484
|
-
|
485
|
-
</div>
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
</div>
|
491
|
-
|
492
|
-
|
493
|
-
<div id="method-i-stack" class="method-detail ">
|
494
|
-
|
495
|
-
<div class="method-heading">
|
496
|
-
<span class="method-name">stack</span><span
|
497
|
-
class="method-args">()</span>
|
498
|
-
|
499
|
-
<span class="method-click-advice">click to toggle source</span>
|
500
|
-
|
501
|
-
</div>
|
502
|
-
|
503
|
-
|
504
|
-
<div class="method-description">
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
<div class="method-source-code" id="stack-source">
|
512
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line 17</span>
|
513
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">stack</span>
|
514
|
-
<span class="ruby-ivar">@stack</span> <span class="ruby-operator">||=</span> <span class="ruby-keyword">begin</span>
|
515
|
-
<span class="ruby-identifier">methods</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
|
516
|
-
<span class="ruby-identifier">call_info</span> = <span class="ruby-keyword">self</span>
|
517
|
-
|
518
|
-
<span class="ruby-keyword">while</span> <span class="ruby-identifier">call_info</span>
|
519
|
-
<span class="ruby-identifier">methods</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">call_info</span>.<span class="ruby-identifier">target</span>
|
520
|
-
<span class="ruby-identifier">call_info</span> = <span class="ruby-identifier">call_info</span>.<span class="ruby-identifier">parent</span>
|
521
|
-
<span class="ruby-keyword">end</span>
|
522
|
-
<span class="ruby-identifier">methods</span>.<span class="ruby-identifier">reverse</span>
|
523
|
-
<span class="ruby-keyword">end</span>
|
524
|
-
<span class="ruby-keyword">end</span></pre>
|
525
|
-
</div>
|
526
|
-
|
527
|
-
</div>
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
</div>
|
533
|
-
|
534
|
-
|
535
|
-
<div id="method-i-to_s" class="method-detail ">
|
536
|
-
|
537
|
-
<div class="method-heading">
|
538
|
-
<span class="method-name">to_s</span><span
|
539
|
-
class="method-args">()</span>
|
540
|
-
|
541
|
-
<span class="method-click-advice">click to toggle source</span>
|
542
|
-
|
543
|
-
</div>
|
544
|
-
|
545
|
-
|
546
|
-
<div class="method-description">
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
<div class="method-source-code" id="to_s-source">
|
554
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line 57</span>
|
555
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">to_s</span>
|
556
|
-
<span class="ruby-node">"#{target.full_name} (c: #{called}, tt: #{total_time}, st: #{self_time}, ct: #{children_time})"</span>
|
557
|
-
<span class="ruby-keyword">end</span></pre>
|
558
|
-
</div>
|
559
|
-
|
560
|
-
</div>
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
</div>
|
566
|
-
|
567
|
-
|
568
|
-
</section>
|
569
|
-
|
570
|
-
</section>
|
571
|
-
</main>
|
572
|
-
|
573
|
-
|
574
|
-
<footer id="validator-badges" role="contentinfo">
|
575
|
-
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
576
|
-
<p>Generated by <a href="https://rdoc.github.io/rdoc">RDoc</a> 5.1.0.
|
577
|
-
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
578
|
-
</footer>
|
579
|
-
|