ruby-prof 0.15.3 → 0.15.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES +9 -0
- data/README.rdoc +24 -39
- data/bin/ruby-prof +1 -2
- data/doc/created.rid +8 -8
- data/doc/js/search_index.js +1 -1
- data/doc/js/search_index.js.gz +0 -0
- data/ext/ruby_prof/rp_measure.c +20 -28
- data/ext/ruby_prof/rp_measure.h +6 -6
- data/ext/ruby_prof/rp_measure_allocations.c +9 -2
- data/ext/ruby_prof/rp_measure_memory.c +4 -0
- data/lib/ruby-prof.rb +9 -20
- data/lib/ruby-prof/compatibility.rb +12 -4
- data/lib/ruby-prof/printers/flat_printer.rb +1 -0
- data/lib/ruby-prof/version.rb +1 -1
- data/test/thread_test.rb +7 -4
- metadata +2 -54
- data/doc/LICENSE.html +0 -114
- data/doc/README_rdoc.html +0 -607
- data/doc/Rack.html +0 -95
- data/doc/Rack/RubyProf.html +0 -264
- data/doc/RubyProf.html +0 -965
- data/doc/RubyProf/AbstractPrinter.html +0 -546
- data/doc/RubyProf/AggregateCallInfo.html +0 -537
- data/doc/RubyProf/CallInfo.html +0 -468
- data/doc/RubyProf/CallInfoPrinter.html +0 -120
- data/doc/RubyProf/CallInfoVisitor.html +0 -200
- data/doc/RubyProf/CallStackPrinter.html +0 -1604
- data/doc/RubyProf/CallTreePrinter.html +0 -359
- data/doc/RubyProf/Cmd.html +0 -624
- data/doc/RubyProf/DotPrinter.html +0 -257
- data/doc/RubyProf/FlatPrinter.html +0 -163
- data/doc/RubyProf/FlatPrinterWithLineNumbers.html +0 -201
- data/doc/RubyProf/GraphHtmlPrinter.html +0 -575
- data/doc/RubyProf/GraphPrinter.html +0 -139
- data/doc/RubyProf/MethodInfo.html +0 -685
- data/doc/RubyProf/MultiPrinter.html +0 -358
- data/doc/RubyProf/Profile.html +0 -764
- data/doc/RubyProf/ProfileTask.html +0 -490
- data/doc/RubyProf/Thread.html +0 -199
- 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 -633
- data/doc/table_of_contents.html +0 -859
@@ -1,257 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
|
3
|
-
<html>
|
4
|
-
<head>
|
5
|
-
<meta charset="UTF-8">
|
6
|
-
|
7
|
-
<title>class RubyProf::DotPrinter - 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"><a href="AbstractPrinter.html">RubyProf::AbstractPrinter</a>
|
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 class="calls-super" ><a href="#method-c-new">::new</a>
|
74
|
-
|
75
|
-
<li ><a href="#method-i-print">#print</a>
|
76
|
-
|
77
|
-
</ul>
|
78
|
-
</div>
|
79
|
-
|
80
|
-
</div>
|
81
|
-
</nav>
|
82
|
-
|
83
|
-
<main role="main" aria-labelledby="class-RubyProf::DotPrinter">
|
84
|
-
<h1 id="class-RubyProf::DotPrinter" class="class">
|
85
|
-
class RubyProf::DotPrinter
|
86
|
-
</h1>
|
87
|
-
|
88
|
-
<section class="description">
|
89
|
-
|
90
|
-
<p>Generates a graphviz graph in dot format. To use the dot printer:</p>
|
91
|
-
|
92
|
-
<pre>result = RubyProf.profile do
|
93
|
-
[code to profile]
|
94
|
-
end
|
95
|
-
|
96
|
-
printer = RubyProf::DotPrinter.new(result)
|
97
|
-
printer.print(STDOUT)</pre>
|
98
|
-
|
99
|
-
<p>You can use either dot viewer such as GraphViz, or the dot command line
|
100
|
-
tool to reformat the output into a wide variety of outputs:</p>
|
101
|
-
|
102
|
-
<pre>dot -Tpng graph.dot > graph.png</pre>
|
103
|
-
|
104
|
-
</section>
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
<section id="5Buntitled-5D" class="documentation-section">
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
<section class="constants-list">
|
116
|
-
<header>
|
117
|
-
<h3>Constants</h3>
|
118
|
-
</header>
|
119
|
-
<dl>
|
120
|
-
|
121
|
-
<dt id="CLASS_COLOR">CLASS_COLOR
|
122
|
-
|
123
|
-
<dd>
|
124
|
-
|
125
|
-
|
126
|
-
<dt id="EDGE_COLOR">EDGE_COLOR
|
127
|
-
|
128
|
-
<dd>
|
129
|
-
|
130
|
-
|
131
|
-
</dl>
|
132
|
-
</section>
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
<section id="public-class-5Buntitled-5D-method-details" class="method-section">
|
139
|
-
<header>
|
140
|
-
<h3>Public Class Methods</h3>
|
141
|
-
</header>
|
142
|
-
|
143
|
-
|
144
|
-
<div id="method-c-new" class="method-detail ">
|
145
|
-
|
146
|
-
<div class="method-heading">
|
147
|
-
<span class="method-name">new</span><span
|
148
|
-
class="method-args">(result)</span>
|
149
|
-
|
150
|
-
<span class="method-click-advice">click to toggle source</span>
|
151
|
-
|
152
|
-
</div>
|
153
|
-
|
154
|
-
|
155
|
-
<div class="method-description">
|
156
|
-
|
157
|
-
<p>Creates the <a href="DotPrinter.html">DotPrinter</a> using a
|
158
|
-
RubyProf::Result.</p>
|
159
|
-
|
160
|
-
|
161
|
-
<div class="method-calls-super">
|
162
|
-
Calls superclass method
|
163
|
-
<a href="AbstractPrinter.html#method-c-new">RubyProf::AbstractPrinter.new</a>
|
164
|
-
</div>
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
<div class="method-source-code" id="new-source">
|
169
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/printers/dot_printer.rb, line 25</span>
|
170
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">result</span>)
|
171
|
-
<span class="ruby-keyword">super</span>(<span class="ruby-identifier">result</span>)
|
172
|
-
<span class="ruby-ivar">@seen_methods</span> = <span class="ruby-constant">Set</span>.<span class="ruby-identifier">new</span>
|
173
|
-
<span class="ruby-keyword">end</span></pre>
|
174
|
-
</div>
|
175
|
-
|
176
|
-
</div>
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
</div>
|
182
|
-
|
183
|
-
|
184
|
-
</section>
|
185
|
-
|
186
|
-
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
187
|
-
<header>
|
188
|
-
<h3>Public Instance Methods</h3>
|
189
|
-
</header>
|
190
|
-
|
191
|
-
|
192
|
-
<div id="method-i-print" class="method-detail ">
|
193
|
-
|
194
|
-
<div class="method-heading">
|
195
|
-
<span class="method-name">print</span><span
|
196
|
-
class="method-args">(output = STDOUT, options = {})</span>
|
197
|
-
|
198
|
-
<span class="method-click-advice">click to toggle source</span>
|
199
|
-
|
200
|
-
</div>
|
201
|
-
|
202
|
-
|
203
|
-
<div class="method-description">
|
204
|
-
|
205
|
-
<p>Print a graph report to the provided output.</p>
|
206
|
-
|
207
|
-
<p>output - Any IO object, including STDOUT or a file. The default value is
|
208
|
-
STDOUT.</p>
|
209
|
-
|
210
|
-
<p>options - Hash of print options. See <a
|
211
|
-
href="AbstractPrinter.html#method-i-setup_options">setup_options</a> for
|
212
|
-
more information.</p>
|
213
|
-
|
214
|
-
<p>When profiling results that cover a large number of method calls it helps
|
215
|
-
to use the :min_percent option, for example:</p>
|
216
|
-
|
217
|
-
<pre class="ruby"><span class="ruby-constant">DotPrinter</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">result</span>).<span class="ruby-identifier">print</span>(<span class="ruby-constant">STDOUT</span>, :<span class="ruby-identifier">min_percent=</span><span class="ruby-operator">></span><span class="ruby-value">5</span>)
|
218
|
-
</pre>
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
<div class="method-source-code" id="print-source">
|
224
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/printers/dot_printer.rb, line 43</span>
|
225
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">print</span>(<span class="ruby-identifier">output</span> = <span class="ruby-constant">STDOUT</span>, <span class="ruby-identifier">options</span> = {})
|
226
|
-
<span class="ruby-ivar">@output</span> = <span class="ruby-identifier">output</span>
|
227
|
-
<span class="ruby-identifier">setup_options</span>(<span class="ruby-identifier">options</span>)
|
228
|
-
|
229
|
-
<span class="ruby-identifier">puts</span> <span class="ruby-string">'digraph "Profile" {'</span>
|
230
|
-
<span class="ruby-comment">#puts "label=\"#{mode_name} >=#{min_percent}%\\nTotal: #{total_time}\";"</span>
|
231
|
-
<span class="ruby-identifier">puts</span> <span class="ruby-string">"labelloc=t;"</span>
|
232
|
-
<span class="ruby-identifier">puts</span> <span class="ruby-string">"labeljust=l;"</span>
|
233
|
-
<span class="ruby-identifier">print_threads</span>
|
234
|
-
<span class="ruby-identifier">puts</span> <span class="ruby-string">'}'</span>
|
235
|
-
<span class="ruby-keyword">end</span></pre>
|
236
|
-
</div>
|
237
|
-
|
238
|
-
</div>
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
</div>
|
244
|
-
|
245
|
-
|
246
|
-
</section>
|
247
|
-
|
248
|
-
</section>
|
249
|
-
</main>
|
250
|
-
|
251
|
-
|
252
|
-
<footer id="validator-badges" role="contentinfo">
|
253
|
-
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
254
|
-
<p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.0.
|
255
|
-
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
256
|
-
</footer>
|
257
|
-
|
@@ -1,163 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
|
3
|
-
<html>
|
4
|
-
<head>
|
5
|
-
<meta charset="UTF-8">
|
6
|
-
|
7
|
-
<title>class RubyProf::FlatPrinter - 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"><a href="AbstractPrinter.html">RubyProf::AbstractPrinter</a>
|
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-i-sort_method">#sort_method</a>
|
74
|
-
|
75
|
-
</ul>
|
76
|
-
</div>
|
77
|
-
|
78
|
-
</div>
|
79
|
-
</nav>
|
80
|
-
|
81
|
-
<main role="main" aria-labelledby="class-RubyProf::FlatPrinter">
|
82
|
-
<h1 id="class-RubyProf::FlatPrinter" class="class">
|
83
|
-
class RubyProf::FlatPrinter
|
84
|
-
</h1>
|
85
|
-
|
86
|
-
<section class="description">
|
87
|
-
|
88
|
-
<p>Generates <a href="../files/examples/flat_txt.html">flat</a> profile
|
89
|
-
reports as text. To use the flat printer:</p>
|
90
|
-
|
91
|
-
<pre>result = RubyProf.profile do
|
92
|
-
[code to profile]
|
93
|
-
end
|
94
|
-
|
95
|
-
printer = RubyProf::FlatPrinter.new(result)
|
96
|
-
printer.print(STDOUT, {})</pre>
|
97
|
-
|
98
|
-
</section>
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
<section id="5Buntitled-5D" class="documentation-section">
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
114
|
-
<header>
|
115
|
-
<h3>Public Instance Methods</h3>
|
116
|
-
</header>
|
117
|
-
|
118
|
-
|
119
|
-
<div id="method-i-sort_method" class="method-detail ">
|
120
|
-
|
121
|
-
<div class="method-heading">
|
122
|
-
<span class="method-name">sort_method</span><span
|
123
|
-
class="method-args">()</span>
|
124
|
-
|
125
|
-
<span class="method-click-advice">click to toggle source</span>
|
126
|
-
|
127
|
-
</div>
|
128
|
-
|
129
|
-
|
130
|
-
<div class="method-description">
|
131
|
-
|
132
|
-
<p>Override for this printer to sort by self time by default</p>
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
<div class="method-source-code" id="sort_method-source">
|
138
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/printers/flat_printer.rb, line 15</span>
|
139
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">sort_method</span>
|
140
|
-
<span class="ruby-ivar">@options</span>[<span class="ruby-value">:sort_method</span>] <span class="ruby-operator">||</span> <span class="ruby-value">:self_time</span>
|
141
|
-
<span class="ruby-keyword">end</span></pre>
|
142
|
-
</div>
|
143
|
-
|
144
|
-
</div>
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
</div>
|
150
|
-
|
151
|
-
|
152
|
-
</section>
|
153
|
-
|
154
|
-
</section>
|
155
|
-
</main>
|
156
|
-
|
157
|
-
|
158
|
-
<footer id="validator-badges" role="contentinfo">
|
159
|
-
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
160
|
-
<p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.0.
|
161
|
-
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
162
|
-
</footer>
|
163
|
-
|
@@ -1,201 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
|
3
|
-
<html>
|
4
|
-
<head>
|
5
|
-
<meta charset="UTF-8">
|
6
|
-
|
7
|
-
<title>class RubyProf::FlatPrinterWithLineNumbers - 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"><a href="FlatPrinter.html">RubyProf::FlatPrinter</a>
|
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-i-print_methods">#print_methods</a>
|
74
|
-
|
75
|
-
</ul>
|
76
|
-
</div>
|
77
|
-
|
78
|
-
</div>
|
79
|
-
</nav>
|
80
|
-
|
81
|
-
<main role="main" aria-labelledby="class-RubyProf::FlatPrinterWithLineNumbers">
|
82
|
-
<h1 id="class-RubyProf::FlatPrinterWithLineNumbers" class="class">
|
83
|
-
class RubyProf::FlatPrinterWithLineNumbers
|
84
|
-
</h1>
|
85
|
-
|
86
|
-
<section class="description">
|
87
|
-
|
88
|
-
<p>Generates <a href="../files/examples/flat_txt.html">flat</a> profile
|
89
|
-
reports as text. To use the flat printer with line numbers:</p>
|
90
|
-
|
91
|
-
<pre>result = RubyProf.profile do
|
92
|
-
[code to profile]
|
93
|
-
end
|
94
|
-
|
95
|
-
printer = RubyProf::FlatPrinterWithLineNumbers.new(result)
|
96
|
-
printer.print(STDOUT, {})</pre>
|
97
|
-
|
98
|
-
</section>
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
<section id="5Buntitled-5D" class="documentation-section">
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
114
|
-
<header>
|
115
|
-
<h3>Public Instance Methods</h3>
|
116
|
-
</header>
|
117
|
-
|
118
|
-
|
119
|
-
<div id="method-i-print_methods" class="method-detail ">
|
120
|
-
|
121
|
-
<div class="method-heading">
|
122
|
-
<span class="method-name">print_methods</span><span
|
123
|
-
class="method-args">(thread)</span>
|
124
|
-
|
125
|
-
<span class="method-click-advice">click to toggle source</span>
|
126
|
-
|
127
|
-
</div>
|
128
|
-
|
129
|
-
|
130
|
-
<div class="method-description">
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
<div class="method-source-code" id="print_methods-source">
|
138
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/printers/flat_printer_with_line_numbers.rb, line 14</span>
|
139
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">print_methods</span>(<span class="ruby-identifier">thread</span>)
|
140
|
-
<span class="ruby-identifier">total_time</span> = <span class="ruby-identifier">thread</span>.<span class="ruby-identifier">total_time</span>
|
141
|
-
|
142
|
-
<span class="ruby-identifier">methods</span> = <span class="ruby-identifier">thread</span>.<span class="ruby-identifier">methods</span>.<span class="ruby-identifier">sort_by</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">sort_method</span>).<span class="ruby-identifier">reverse</span>
|
143
|
-
<span class="ruby-identifier">sum</span> = <span class="ruby-value">0</span>
|
144
|
-
<span class="ruby-identifier">methods</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">method</span><span class="ruby-operator">|</span>
|
145
|
-
<span class="ruby-identifier">self_percent</span> = (<span class="ruby-identifier">method</span>.<span class="ruby-identifier">self_time</span> <span class="ruby-operator">/</span> <span class="ruby-identifier">total_time</span>) <span class="ruby-operator">*</span> <span class="ruby-value">100</span>
|
146
|
-
<span class="ruby-keyword">next</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">self_percent</span> <span class="ruby-operator"><</span> <span class="ruby-identifier">min_percent</span>
|
147
|
-
|
148
|
-
<span class="ruby-identifier">sum</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">method</span>.<span class="ruby-identifier">self_time</span>
|
149
|
-
<span class="ruby-comment">#self_time_called = method.called > 0 ? method.self_time/method.called : 0</span>
|
150
|
-
<span class="ruby-comment">#total_time_called = method.called > 0? method.total_time/method.called : 0</span>
|
151
|
-
|
152
|
-
<span class="ruby-ivar">@output</span> <span class="ruby-operator"><<</span> <span class="ruby-string">"%6.2f %9.3f %9.3f %9.3f %9.3f %8d %s%s \n"</span> <span class="ruby-operator">%</span> [
|
153
|
-
<span class="ruby-identifier">method</span>.<span class="ruby-identifier">self_time</span> <span class="ruby-operator">/</span> <span class="ruby-identifier">total_time</span> <span class="ruby-operator">*</span> <span class="ruby-value">100</span>, <span class="ruby-comment"># %self</span>
|
154
|
-
<span class="ruby-identifier">method</span>.<span class="ruby-identifier">total_time</span>, <span class="ruby-comment"># total</span>
|
155
|
-
<span class="ruby-identifier">method</span>.<span class="ruby-identifier">self_time</span>, <span class="ruby-comment"># self</span>
|
156
|
-
<span class="ruby-identifier">method</span>.<span class="ruby-identifier">wait_time</span>, <span class="ruby-comment"># wait</span>
|
157
|
-
<span class="ruby-identifier">method</span>.<span class="ruby-identifier">children_time</span>, <span class="ruby-comment"># children</span>
|
158
|
-
<span class="ruby-identifier">method</span>.<span class="ruby-identifier">called</span>, <span class="ruby-comment"># calls</span>
|
159
|
-
<span class="ruby-identifier">method</span>.<span class="ruby-identifier">recursive?</span> <span class="ruby-operator">?</span> <span class="ruby-string">"*"</span> <span class="ruby-operator">:</span> <span class="ruby-string">" "</span>, <span class="ruby-comment"># cycle</span>
|
160
|
-
<span class="ruby-identifier">method_name</span>(<span class="ruby-identifier">method</span>) <span class="ruby-comment"># name</span>
|
161
|
-
]
|
162
|
-
<span class="ruby-keyword">if</span> <span class="ruby-identifier">method</span>.<span class="ruby-identifier">source_file</span> <span class="ruby-operator">!=</span> <span class="ruby-string">'ruby_runtime'</span>
|
163
|
-
<span class="ruby-ivar">@output</span> <span class="ruby-operator"><<</span> <span class="ruby-string">" %s:%s"</span> <span class="ruby-operator">%</span> [<span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-identifier">method</span>.<span class="ruby-identifier">source_file</span>), <span class="ruby-identifier">method</span>.<span class="ruby-identifier">line</span>]
|
164
|
-
<span class="ruby-keyword">end</span>
|
165
|
-
<span class="ruby-ivar">@output</span> <span class="ruby-operator"><<</span> <span class="ruby-string">"\n\tcalled from: "</span>
|
166
|
-
|
167
|
-
<span class="ruby-comment"># make sure they're unique</span>
|
168
|
-
<span class="ruby-identifier">method</span>.<span class="ruby-identifier">call_infos</span>.<span class="ruby-identifier">map</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">ci</span><span class="ruby-operator">|</span>
|
169
|
-
<span class="ruby-keyword">if</span> <span class="ruby-identifier">ci</span>.<span class="ruby-identifier">parent</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">ci</span>.<span class="ruby-identifier">parent</span>.<span class="ruby-identifier">target</span>.<span class="ruby-identifier">source_file</span> <span class="ruby-operator">!=</span> <span class="ruby-string">'ruby_runtime'</span>
|
170
|
-
[<span class="ruby-identifier">method_name</span>(<span class="ruby-identifier">ci</span>.<span class="ruby-identifier">parent</span>.<span class="ruby-identifier">target</span>), <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-identifier">ci</span>.<span class="ruby-identifier">parent</span>.<span class="ruby-identifier">target</span>.<span class="ruby-identifier">source_file</span>), <span class="ruby-identifier">ci</span>.<span class="ruby-identifier">parent</span>.<span class="ruby-identifier">target</span>.<span class="ruby-identifier">line</span>]
|
171
|
-
<span class="ruby-keyword">else</span>
|
172
|
-
<span class="ruby-keyword">nil</span>
|
173
|
-
<span class="ruby-keyword">end</span>
|
174
|
-
}.<span class="ruby-identifier">compact</span>.<span class="ruby-identifier">uniq</span>.<span class="ruby-identifier">each</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">args</span><span class="ruby-operator">|</span>
|
175
|
-
<span class="ruby-ivar">@output</span> <span class="ruby-operator"><<</span> <span class="ruby-string">" %s (%s:%s) "</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">args</span>
|
176
|
-
}
|
177
|
-
<span class="ruby-ivar">@output</span> <span class="ruby-operator"><<</span> <span class="ruby-string">"\n\n"</span>
|
178
|
-
<span class="ruby-keyword">end</span>
|
179
|
-
<span class="ruby-keyword">end</span></pre>
|
180
|
-
</div>
|
181
|
-
|
182
|
-
</div>
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
</div>
|
188
|
-
|
189
|
-
|
190
|
-
</section>
|
191
|
-
|
192
|
-
</section>
|
193
|
-
</main>
|
194
|
-
|
195
|
-
|
196
|
-
<footer id="validator-badges" role="contentinfo">
|
197
|
-
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
198
|
-
<p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.0.
|
199
|
-
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
200
|
-
</footer>
|
201
|
-
|