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.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES +9 -0
  3. data/README.rdoc +24 -39
  4. data/bin/ruby-prof +1 -2
  5. data/doc/created.rid +8 -8
  6. data/doc/js/search_index.js +1 -1
  7. data/doc/js/search_index.js.gz +0 -0
  8. data/ext/ruby_prof/rp_measure.c +20 -28
  9. data/ext/ruby_prof/rp_measure.h +6 -6
  10. data/ext/ruby_prof/rp_measure_allocations.c +9 -2
  11. data/ext/ruby_prof/rp_measure_memory.c +4 -0
  12. data/lib/ruby-prof.rb +9 -20
  13. data/lib/ruby-prof/compatibility.rb +12 -4
  14. data/lib/ruby-prof/printers/flat_printer.rb +1 -0
  15. data/lib/ruby-prof/version.rb +1 -1
  16. data/test/thread_test.rb +7 -4
  17. metadata +2 -54
  18. data/doc/LICENSE.html +0 -114
  19. data/doc/README_rdoc.html +0 -607
  20. data/doc/Rack.html +0 -95
  21. data/doc/Rack/RubyProf.html +0 -264
  22. data/doc/RubyProf.html +0 -965
  23. data/doc/RubyProf/AbstractPrinter.html +0 -546
  24. data/doc/RubyProf/AggregateCallInfo.html +0 -537
  25. data/doc/RubyProf/CallInfo.html +0 -468
  26. data/doc/RubyProf/CallInfoPrinter.html +0 -120
  27. data/doc/RubyProf/CallInfoVisitor.html +0 -200
  28. data/doc/RubyProf/CallStackPrinter.html +0 -1604
  29. data/doc/RubyProf/CallTreePrinter.html +0 -359
  30. data/doc/RubyProf/Cmd.html +0 -624
  31. data/doc/RubyProf/DotPrinter.html +0 -257
  32. data/doc/RubyProf/FlatPrinter.html +0 -163
  33. data/doc/RubyProf/FlatPrinterWithLineNumbers.html +0 -201
  34. data/doc/RubyProf/GraphHtmlPrinter.html +0 -575
  35. data/doc/RubyProf/GraphPrinter.html +0 -139
  36. data/doc/RubyProf/MethodInfo.html +0 -685
  37. data/doc/RubyProf/MultiPrinter.html +0 -358
  38. data/doc/RubyProf/Profile.html +0 -764
  39. data/doc/RubyProf/ProfileTask.html +0 -490
  40. data/doc/RubyProf/Thread.html +0 -199
  41. data/doc/examples/flat_txt.html +0 -149
  42. data/doc/examples/graph_html.html +0 -850
  43. data/doc/examples/graph_txt.html +0 -274
  44. data/doc/images/add.png +0 -0
  45. data/doc/images/arrow_up.png +0 -0
  46. data/doc/images/brick.png +0 -0
  47. data/doc/images/brick_link.png +0 -0
  48. data/doc/images/bug.png +0 -0
  49. data/doc/images/bullet_black.png +0 -0
  50. data/doc/images/bullet_toggle_minus.png +0 -0
  51. data/doc/images/bullet_toggle_plus.png +0 -0
  52. data/doc/images/date.png +0 -0
  53. data/doc/images/delete.png +0 -0
  54. data/doc/images/find.png +0 -0
  55. data/doc/images/macFFBgHack.png +0 -0
  56. data/doc/images/package.png +0 -0
  57. data/doc/images/page_green.png +0 -0
  58. data/doc/images/page_white_text.png +0 -0
  59. data/doc/images/page_white_width.png +0 -0
  60. data/doc/images/plugin.png +0 -0
  61. data/doc/images/ruby.png +0 -0
  62. data/doc/images/tag_blue.png +0 -0
  63. data/doc/images/tag_green.png +0 -0
  64. data/doc/images/transparent.png +0 -0
  65. data/doc/images/wrench.png +0 -0
  66. data/doc/images/wrench_orange.png +0 -0
  67. data/doc/images/zoom.png +0 -0
  68. data/doc/index.html +0 -633
  69. data/doc/table_of_contents.html +0 -859
@@ -1,359 +0,0 @@
1
- <!DOCTYPE html>
2
-
3
- <html>
4
- <head>
5
- <meta charset="UTF-8">
6
-
7
- <title>class RubyProf::CallTreePrinter - 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-convert">#convert</a>
74
-
75
- <li ><a href="#method-i-file">#file</a>
76
-
77
- <li ><a href="#method-i-print">#print</a>
78
-
79
- <li ><a href="#method-i-print_thread">#print_thread</a>
80
-
81
- <li ><a href="#method-i-print_threads">#print_threads</a>
82
-
83
- </ul>
84
- </div>
85
-
86
- </div>
87
- </nav>
88
-
89
- <main role="main" aria-labelledby="class-RubyProf::CallTreePrinter">
90
- <h1 id="class-RubyProf::CallTreePrinter" class="class">
91
- class RubyProf::CallTreePrinter
92
- </h1>
93
-
94
- <section class="description">
95
-
96
- <p>Generate profiling information in calltree format for use by kcachegrind
97
- and similar tools.</p>
98
-
99
- </section>
100
-
101
-
102
-
103
-
104
- <section id="5Buntitled-5D" class="documentation-section">
105
-
106
-
107
-
108
-
109
-
110
-
111
-
112
-
113
-
114
- <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
115
- <header>
116
- <h3>Public Instance Methods</h3>
117
- </header>
118
-
119
-
120
- <div id="method-i-convert" class="method-detail ">
121
-
122
- <div class="method-heading">
123
- <span class="method-name">convert</span><span
124
- class="method-args">(value)</span>
125
-
126
- <span class="method-click-advice">click to toggle source</span>
127
-
128
- </div>
129
-
130
-
131
- <div class="method-description">
132
-
133
-
134
-
135
-
136
-
137
-
138
- <div class="method-source-code" id="convert-source">
139
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_tree_printer.rb, line 61</span>
140
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">convert</span>(<span class="ruby-identifier">value</span>)
141
- (<span class="ruby-identifier">value</span> <span class="ruby-operator">*</span> <span class="ruby-ivar">@value_scale</span>).<span class="ruby-identifier">round</span>
142
- <span class="ruby-keyword">end</span></pre>
143
- </div>
144
-
145
- </div>
146
-
147
-
148
-
149
-
150
- </div>
151
-
152
-
153
- <div id="method-i-file" class="method-detail ">
154
-
155
- <div class="method-heading">
156
- <span class="method-name">file</span><span
157
- class="method-args">(method)</span>
158
-
159
- <span class="method-click-advice">click to toggle source</span>
160
-
161
- </div>
162
-
163
-
164
- <div class="method-description">
165
-
166
-
167
-
168
-
169
-
170
-
171
- <div class="method-source-code" id="file-source">
172
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_tree_printer.rb, line 65</span>
173
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">file</span>(<span class="ruby-identifier">method</span>)
174
- <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>)
175
- <span class="ruby-keyword">end</span></pre>
176
- </div>
177
-
178
- </div>
179
-
180
-
181
-
182
-
183
- </div>
184
-
185
-
186
- <div id="method-i-print" class="method-detail ">
187
-
188
- <div class="method-heading">
189
- <span class="method-name">print</span><span
190
- class="method-args">(output = STDOUT, options = {})</span>
191
-
192
- <span class="method-click-advice">click to toggle source</span>
193
-
194
- </div>
195
-
196
-
197
- <div class="method-description">
198
-
199
- <p>Specify print options.</p>
200
-
201
- <p>options - Hash table</p>
202
-
203
- <pre>:min_percent - Number 0 to 100 that specifes the minimum
204
- %self (the methods self time divided by the
205
- overall total time) that a method must take
206
- for it to be printed out in the report.
207
- Default value is 0.
208
-
209
- :print_file - True or false. Specifies if a method&#39;s source
210
- file should be printed. Default value if false.</pre>
211
-
212
-
213
-
214
-
215
- <div class="method-source-code" id="print-source">
216
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_tree_printer.rb, line 19</span>
217
- <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> = {})
218
- <span class="ruby-ivar">@output</span> = <span class="ruby-identifier">output</span>
219
- <span class="ruby-identifier">setup_options</span>(<span class="ruby-identifier">options</span>)
220
-
221
- <span class="ruby-comment"># add a header - this information is somewhat arbitrary</span>
222
- <span class="ruby-ivar">@output</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&quot;events: &quot;</span>
223
- <span class="ruby-keyword">case</span> <span class="ruby-constant">RubyProf</span>.<span class="ruby-identifier">measure_mode</span>
224
- <span class="ruby-keyword">when</span> <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">PROCESS_TIME</span>
225
- <span class="ruby-ivar">@value_scale</span> = <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">CLOCKS_PER_SEC</span>;
226
- <span class="ruby-ivar">@output</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&#39;process_time&#39;</span>
227
- <span class="ruby-keyword">when</span> <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">WALL_TIME</span>
228
- <span class="ruby-ivar">@value_scale</span> = <span class="ruby-value">1_000_000</span>
229
- <span class="ruby-ivar">@output</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&#39;wall_time&#39;</span>
230
- <span class="ruby-keyword">when</span> <span class="ruby-constant">RubyProf</span>.<span class="ruby-identifier">const_defined?</span>(<span class="ruby-value">:CPU_TIME</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">CPU_TIME</span>
231
- <span class="ruby-ivar">@value_scale</span> = <span class="ruby-constant">RubyProf</span>.<span class="ruby-identifier">cpu_frequency</span>
232
- <span class="ruby-ivar">@output</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&#39;cpu_time&#39;</span>
233
- <span class="ruby-keyword">when</span> <span class="ruby-constant">RubyProf</span>.<span class="ruby-identifier">const_defined?</span>(<span class="ruby-value">:ALLOCATIONS</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">ALLOCATIONS</span>
234
- <span class="ruby-ivar">@value_scale</span> = <span class="ruby-value">1</span>
235
- <span class="ruby-ivar">@output</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&#39;allocations&#39;</span>
236
- <span class="ruby-keyword">when</span> <span class="ruby-constant">RubyProf</span>.<span class="ruby-identifier">const_defined?</span>(<span class="ruby-value">:MEMORY</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">MEMORY</span>
237
- <span class="ruby-ivar">@value_scale</span> = <span class="ruby-value">1</span>
238
- <span class="ruby-ivar">@output</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&#39;memory&#39;</span>
239
- <span class="ruby-keyword">when</span> <span class="ruby-constant">RubyProf</span>.<span class="ruby-identifier">const_defined?</span>(<span class="ruby-value">:GC_RUNS</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">GC_RUNS</span>
240
- <span class="ruby-ivar">@value_scale</span> = <span class="ruby-value">1</span>
241
- <span class="ruby-ivar">@output</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&#39;gc_runs&#39;</span>
242
- <span class="ruby-keyword">when</span> <span class="ruby-constant">RubyProf</span>.<span class="ruby-identifier">const_defined?</span>(<span class="ruby-value">:GC_TIME</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">GC_TIME</span>
243
- <span class="ruby-ivar">@value_scale</span> = <span class="ruby-value">1000000</span>
244
- <span class="ruby-ivar">@output</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&#39;gc_time&#39;</span>
245
- <span class="ruby-keyword">else</span>
246
- <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;Unknown measure mode: #{RubyProf.measure_mode}&quot;</span>
247
- <span class="ruby-keyword">end</span>
248
- <span class="ruby-ivar">@output</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&quot;\n\n&quot;</span>
249
-
250
- <span class="ruby-identifier">print_threads</span>
251
- <span class="ruby-keyword">end</span></pre>
252
- </div>
253
-
254
- </div>
255
-
256
-
257
-
258
-
259
- </div>
260
-
261
-
262
- <div id="method-i-print_thread" class="method-detail ">
263
-
264
- <div class="method-heading">
265
- <span class="method-name">print_thread</span><span
266
- class="method-args">(thread)</span>
267
-
268
- <span class="method-click-advice">click to toggle source</span>
269
-
270
- </div>
271
-
272
-
273
- <div class="method-description">
274
-
275
-
276
-
277
-
278
-
279
-
280
- <div class="method-source-code" id="print_thread-source">
281
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_tree_printer.rb, line 69</span>
282
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">print_thread</span>(<span class="ruby-identifier">thread</span>)
283
- <span class="ruby-identifier">thread</span>.<span class="ruby-identifier">methods</span>.<span class="ruby-identifier">reverse_each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">method</span><span class="ruby-operator">|</span>
284
- <span class="ruby-comment"># Print out the file and method name</span>
285
- <span class="ruby-ivar">@output</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;fl=#{file(method)}\n&quot;</span>
286
- <span class="ruby-ivar">@output</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;fn=#{method_name(method)}\n&quot;</span>
287
-
288
- <span class="ruby-comment"># Now print out the function line number and its self time</span>
289
- <span class="ruby-ivar">@output</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;#{method.line} #{convert(method.self_time)}\n&quot;</span>
290
-
291
- <span class="ruby-comment"># Now print out all the children methods</span>
292
- <span class="ruby-identifier">method</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">callee</span><span class="ruby-operator">|</span>
293
- <span class="ruby-ivar">@output</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;cfl=#{file(callee.target)}\n&quot;</span>
294
- <span class="ruby-ivar">@output</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;cfn=#{method_name(callee.target)}\n&quot;</span>
295
- <span class="ruby-ivar">@output</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;calls=#{callee.called} #{callee.line}\n&quot;</span>
296
-
297
- <span class="ruby-comment"># Print out total times here!</span>
298
- <span class="ruby-ivar">@output</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;#{callee.line} #{convert(callee.total_time)}\n&quot;</span>
299
- <span class="ruby-keyword">end</span>
300
- <span class="ruby-ivar">@output</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&quot;\n&quot;</span>
301
- <span class="ruby-keyword">end</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-print_threads" class="method-detail ">
314
-
315
- <div class="method-heading">
316
- <span class="method-name">print_threads</span><span
317
- class="method-args">()</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="print_threads-source">
332
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_tree_printer.rb, line 55</span>
333
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">print_threads</span>
334
- <span class="ruby-ivar">@result</span>.<span class="ruby-identifier">threads</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">thread</span><span class="ruby-operator">|</span>
335
- <span class="ruby-identifier">print_thread</span>(<span class="ruby-identifier">thread</span>)
336
- <span class="ruby-keyword">end</span>
337
- <span class="ruby-keyword">end</span></pre>
338
- </div>
339
-
340
- </div>
341
-
342
-
343
-
344
-
345
- </div>
346
-
347
-
348
- </section>
349
-
350
- </section>
351
- </main>
352
-
353
-
354
- <footer id="validator-badges" role="contentinfo">
355
- <p><a href="http://validator.w3.org/check/referer">Validate</a>
356
- <p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.0.
357
- <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
358
- </footer>
359
-
@@ -1,624 +0,0 @@
1
- <!DOCTYPE html>
2
-
3
- <html>
4
- <head>
5
- <meta charset="UTF-8">
6
-
7
- <title>class RubyProf::Cmd - 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-new">::new</a>
74
-
75
- <li ><a href="#method-i-load_pre_execs">#load_pre_execs</a>
76
-
77
- <li ><a href="#method-i-load_pre_libs">#load_pre_libs</a>
78
-
79
- <li ><a href="#method-i-option_parser">#option_parser</a>
80
-
81
- <li ><a href="#method-i-parse_args">#parse_args</a>
82
-
83
- <li ><a href="#method-i-run">#run</a>
84
-
85
- <li ><a href="#method-i-setup_options">#setup_options</a>
86
-
87
- </ul>
88
- </div>
89
-
90
- </div>
91
- </nav>
92
-
93
- <main role="main" aria-labelledby="class-RubyProf::Cmd">
94
- <h1 id="class-RubyProf::Cmd" class="class">
95
- class RubyProf::Cmd
96
- </h1>
97
-
98
- <section class="description">
99
-
100
- </section>
101
-
102
-
103
-
104
-
105
- <section id="5Buntitled-5D" class="documentation-section">
106
-
107
-
108
-
109
-
110
-
111
-
112
-
113
- <section class="attribute-method-details" class="method-section">
114
- <header>
115
- <h3>Attributes</h3>
116
- </header>
117
-
118
-
119
- <div id="attribute-i-options" class="method-detail">
120
- <div class="method-heading attribute-method-heading">
121
- <span class="method-name">options</span><span
122
- class="attribute-access-type">[RW]</span>
123
- </div>
124
-
125
- <div class="method-description">
126
-
127
-
128
-
129
- </div>
130
- </div>
131
-
132
- </section>
133
-
134
-
135
-
136
- <section id="public-class-5Buntitled-5D-method-details" class="method-section">
137
- <header>
138
- <h3>Public Class Methods</h3>
139
- </header>
140
-
141
-
142
- <div id="method-c-new" class="method-detail ">
143
-
144
- <div class="method-heading">
145
- <span class="method-name">new</span><span
146
- class="method-args">()</span>
147
-
148
- <span class="method-click-advice">click to toggle source</span>
149
-
150
- </div>
151
-
152
-
153
- <div class="method-description">
154
-
155
-
156
-
157
-
158
-
159
-
160
- <div class="method-source-code" id="new-source">
161
- <pre><span class="ruby-comment"># File bin/ruby-prof, line 28</span>
162
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>
163
- <span class="ruby-identifier">setup_options</span>
164
- <span class="ruby-identifier">parse_args</span>
165
-
166
- <span class="ruby-identifier">load_pre_libs</span>
167
- <span class="ruby-identifier">load_pre_execs</span>
168
- <span class="ruby-keyword">end</span></pre>
169
- </div>
170
-
171
- </div>
172
-
173
-
174
-
175
-
176
- </div>
177
-
178
-
179
- </section>
180
-
181
- <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
182
- <header>
183
- <h3>Public Instance Methods</h3>
184
- </header>
185
-
186
-
187
- <div id="method-i-load_pre_execs" class="method-detail ">
188
-
189
- <div class="method-heading">
190
- <span class="method-name">load_pre_execs</span><span
191
- class="method-args">()</span>
192
-
193
- <span class="method-click-advice">click to toggle source</span>
194
-
195
- </div>
196
-
197
-
198
- <div class="method-description">
199
-
200
-
201
-
202
-
203
-
204
-
205
- <div class="method-source-code" id="load_pre_execs-source">
206
- <pre><span class="ruby-comment"># File bin/ruby-prof, line 262</span>
207
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">load_pre_execs</span>
208
- <span class="ruby-identifier">options</span>.<span class="ruby-identifier">pre_execs</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">exec</span><span class="ruby-operator">|</span>
209
- <span class="ruby-identifier">eval</span>(<span class="ruby-identifier">exec</span>)
210
- <span class="ruby-keyword">end</span>
211
- <span class="ruby-keyword">end</span></pre>
212
- </div>
213
-
214
- </div>
215
-
216
-
217
-
218
-
219
- </div>
220
-
221
-
222
- <div id="method-i-load_pre_libs" class="method-detail ">
223
-
224
- <div class="method-heading">
225
- <span class="method-name">load_pre_libs</span><span
226
- class="method-args">()</span>
227
-
228
- <span class="method-click-advice">click to toggle source</span>
229
-
230
- </div>
231
-
232
-
233
- <div class="method-description">
234
-
235
-
236
-
237
-
238
-
239
-
240
- <div class="method-source-code" id="load_pre_libs-source">
241
- <pre><span class="ruby-comment"># File bin/ruby-prof, line 256</span>
242
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">load_pre_libs</span>
243
- <span class="ruby-identifier">options</span>.<span class="ruby-identifier">pre_libs</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">lib</span><span class="ruby-operator">|</span>
244
- <span class="ruby-identifier">require</span> <span class="ruby-identifier">lib</span>
245
- <span class="ruby-keyword">end</span>
246
- <span class="ruby-keyword">end</span></pre>
247
- </div>
248
-
249
- </div>
250
-
251
-
252
-
253
-
254
- </div>
255
-
256
-
257
- <div id="method-i-option_parser" class="method-detail ">
258
-
259
- <div class="method-heading">
260
- <span class="method-name">option_parser</span><span
261
- class="method-args">()</span>
262
-
263
- <span class="method-click-advice">click to toggle source</span>
264
-
265
- </div>
266
-
267
-
268
- <div class="method-description">
269
-
270
-
271
-
272
-
273
-
274
-
275
- <div class="method-source-code" id="option_parser-source">
276
- <pre><span class="ruby-comment"># File bin/ruby-prof, line 49</span>
277
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">option_parser</span>
278
- <span class="ruby-constant">OptionParser</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">opts</span><span class="ruby-operator">|</span>
279
- <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">banner</span> = <span class="ruby-node">&quot;ruby_prof #{RubyProf::VERSION}\n&quot;</span> <span class="ruby-operator">+</span>
280
- <span class="ruby-string">&quot;Usage: ruby-prof [options] &lt;script.rb&gt; [--] [profiled-script-command-line-options]&quot;</span>
281
-
282
- <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">separator</span> <span class="ruby-string">&quot;&quot;</span>
283
- <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">separator</span> <span class="ruby-string">&quot;Options:&quot;</span>
284
-
285
- <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-string">&#39;-p printer&#39;</span>, <span class="ruby-string">&#39;--printer=printer&#39;</span>, [<span class="ruby-value">:flat</span>, <span class="ruby-value">:flat_with_line_numbers</span>, <span class="ruby-value">:graph</span>, <span class="ruby-value">:graph_html</span>, <span class="ruby-value">:call_tree</span>, <span class="ruby-value">:call_stack</span>, <span class="ruby-value">:dot</span>],
286
- <span class="ruby-string">&#39;Select a printer:&#39;</span>,
287
- <span class="ruby-string">&#39; flat - Prints a flat profile as text (default).&#39;</span>,
288
- <span class="ruby-string">&#39; flat_with_line_numbers - same as flat, with line numbers.&#39;</span>,
289
- <span class="ruby-string">&#39; graph - Prints a graph profile as text.&#39;</span>,
290
- <span class="ruby-string">&#39; graph_html - Prints a graph profile as html.&#39;</span>,
291
- <span class="ruby-string">&#39; call_tree - format for KCacheGrind&#39;</span>,
292
- <span class="ruby-string">&#39; call_stack - prints a HTML visualization of the call tree&#39;</span>,
293
- <span class="ruby-string">&#39; dot - Prints a graph profile as a dot file&#39;</span>
294
- ) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">printer</span><span class="ruby-operator">|</span>
295
-
296
-
297
- <span class="ruby-keyword">case</span> <span class="ruby-identifier">printer</span>
298
- <span class="ruby-keyword">when</span> <span class="ruby-value">:flat</span>
299
- <span class="ruby-identifier">options</span>.<span class="ruby-identifier">printer</span> = <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">FlatPrinter</span>
300
- <span class="ruby-keyword">when</span> <span class="ruby-value">:flat_with_line_numbers</span>
301
- <span class="ruby-identifier">options</span>.<span class="ruby-identifier">printer</span> = <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">FlatPrinterWithLineNumbers</span>
302
- <span class="ruby-keyword">when</span> <span class="ruby-value">:graph</span>
303
- <span class="ruby-identifier">options</span>.<span class="ruby-identifier">printer</span> = <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">GraphPrinter</span>
304
- <span class="ruby-keyword">when</span> <span class="ruby-value">:graph_html</span>
305
- <span class="ruby-identifier">options</span>.<span class="ruby-identifier">printer</span> = <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">GraphHtmlPrinter</span>
306
- <span class="ruby-keyword">when</span> <span class="ruby-value">:call_tree</span>
307
- <span class="ruby-identifier">options</span>.<span class="ruby-identifier">printer</span> = <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">CallTreePrinter</span>
308
- <span class="ruby-keyword">when</span> <span class="ruby-value">:call_stack</span>
309
- <span class="ruby-identifier">options</span>.<span class="ruby-identifier">printer</span> = <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">CallStackPrinter</span>
310
- <span class="ruby-keyword">when</span> <span class="ruby-value">:dot</span>
311
- <span class="ruby-identifier">options</span>.<span class="ruby-identifier">printer</span> = <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">DotPrinter</span>
312
- <span class="ruby-keyword">end</span>
313
- <span class="ruby-keyword">end</span>
314
-
315
- <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-string">&#39;-m min_percent&#39;</span>, <span class="ruby-string">&#39;--min_percent=min_percent&#39;</span>, <span class="ruby-constant">Float</span>,
316
- <span class="ruby-string">&#39;The minimum percent a method must take before &#39;</span>,
317
- <span class="ruby-string">&#39; being included in output reports.&#39;</span>,
318
- <span class="ruby-string">&#39; this option is not supported for call tree.&#39;</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">min_percent</span><span class="ruby-operator">|</span>
319
- <span class="ruby-identifier">options</span>.<span class="ruby-identifier">min_percent</span> = <span class="ruby-identifier">min_percent</span>
320
- <span class="ruby-keyword">end</span>
321
-
322
- <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-string">&#39;-f path&#39;</span>, <span class="ruby-string">&#39;--file=path&#39;</span>,
323
- <span class="ruby-string">&#39;Output results to a file instead of standard out.&#39;</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">file</span><span class="ruby-operator">|</span>
324
- <span class="ruby-identifier">options</span>.<span class="ruby-identifier">file</span> = <span class="ruby-identifier">file</span>
325
- <span class="ruby-identifier">options</span>.<span class="ruby-identifier">old_wd</span> = <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">pwd</span>
326
- <span class="ruby-keyword">end</span>
327
-
328
- <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-string">&#39;--mode=measure_mode&#39;</span>,
329
- [<span class="ruby-value">:process</span>, <span class="ruby-value">:wall</span>, <span class="ruby-value">:cpu</span>, <span class="ruby-value">:allocations</span>, <span class="ruby-value">:memory</span>, <span class="ruby-value">:gc_runs</span>, <span class="ruby-value">:gc_time</span>],
330
- <span class="ruby-string">&#39;Select what ruby-prof should measure:&#39;</span>,
331
- <span class="ruby-string">&#39; process - Process time (default).&#39;</span>,
332
- <span class="ruby-string">&#39; wall - Wall time.&#39;</span>,
333
- <span class="ruby-string">&#39; cpu - CPU time (Pentium and PowerPCs only).&#39;</span>,
334
- <span class="ruby-string">&#39; allocations - Object allocations (requires patched Ruby interpreter).&#39;</span>,
335
- <span class="ruby-string">&#39; memory - Allocated memory in KB (requires patched Ruby interpreter).&#39;</span>,
336
- <span class="ruby-string">&#39; gc_runs - Number of garbage collections (requires patched Ruby interpreter).&#39;</span>,
337
- <span class="ruby-string">&#39; gc_time - Time spent in garbage collection (requires patched Ruby interpreter).&#39;</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">measure_mode</span><span class="ruby-operator">|</span>
338
-
339
- <span class="ruby-keyword">case</span> <span class="ruby-identifier">measure_mode</span>
340
- <span class="ruby-keyword">when</span> <span class="ruby-value">:process</span>
341
- <span class="ruby-identifier">options</span>.<span class="ruby-identifier">measure_mode</span> = <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">PROCESS_TIME</span>
342
- <span class="ruby-keyword">when</span> <span class="ruby-value">:wall</span>
343
- <span class="ruby-identifier">options</span>.<span class="ruby-identifier">measure_mode</span> = <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">WALL_TIME</span>
344
- <span class="ruby-keyword">when</span> <span class="ruby-value">:cpu</span>
345
- <span class="ruby-identifier">options</span>.<span class="ruby-identifier">measure_mode</span> = <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">CPU_TIME</span>
346
- <span class="ruby-keyword">when</span> <span class="ruby-value">:allocations</span>
347
- <span class="ruby-identifier">options</span>.<span class="ruby-identifier">measure_mode</span> = <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">ALLOCATIONS</span>
348
- <span class="ruby-keyword">when</span> <span class="ruby-value">:memory</span>
349
- <span class="ruby-identifier">options</span>.<span class="ruby-identifier">measure_mode</span> = <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">MEMORY</span>
350
- <span class="ruby-keyword">when</span> <span class="ruby-value">:gc_runs</span>
351
- <span class="ruby-identifier">options</span>.<span class="ruby-identifier">measure_mode</span> = <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">GC_RUNS</span>
352
- <span class="ruby-keyword">when</span> <span class="ruby-value">:gc_time</span>
353
- <span class="ruby-identifier">options</span>.<span class="ruby-identifier">measure_mode</span> = <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">GC_TIME</span>
354
- <span class="ruby-keyword">end</span>
355
- <span class="ruby-keyword">end</span>
356
-
357
- <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-string">&#39;-s sort_mode&#39;</span>, <span class="ruby-string">&#39;--sort=sort_mode&#39;</span>, [<span class="ruby-value">:total</span>, <span class="ruby-value">:self</span>, <span class="ruby-value">:wait</span>, <span class="ruby-value">:child</span>],
358
- <span class="ruby-string">&#39;Select how ruby-prof results should be sorted:&#39;</span>,
359
- <span class="ruby-string">&#39; total - Total time&#39;</span>,
360
- <span class="ruby-string">&#39; self - Self time&#39;</span>,
361
- <span class="ruby-string">&#39; wait - Wait time&#39;</span>,
362
- <span class="ruby-string">&#39; child - Child time&#39;</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">sort_mode</span><span class="ruby-operator">|</span>
363
-
364
- <span class="ruby-identifier">options</span>.<span class="ruby-identifier">sort_method</span> = <span class="ruby-keyword">case</span> <span class="ruby-identifier">sort_mode</span>
365
- <span class="ruby-keyword">when</span> <span class="ruby-value">:total</span>
366
- <span class="ruby-value">:total_time</span>
367
- <span class="ruby-keyword">when</span> <span class="ruby-value">:self</span>
368
- <span class="ruby-value">:self_time</span>
369
- <span class="ruby-keyword">when</span> <span class="ruby-value">:wait</span>
370
- <span class="ruby-value">:wait_time</span>
371
- <span class="ruby-keyword">when</span> <span class="ruby-value">:child</span>
372
- <span class="ruby-value">:children_time</span>
373
- <span class="ruby-keyword">end</span>
374
- <span class="ruby-keyword">end</span>
375
-
376
- <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-string">&quot;--replace-progname&quot;</span>, <span class="ruby-string">&quot;Replace $0 when loading the .rb files.&quot;</span>) <span class="ruby-keyword">do</span>
377
- <span class="ruby-identifier">options</span>.<span class="ruby-identifier">replace_prog_name</span> = <span class="ruby-keyword">true</span>
378
- <span class="ruby-keyword">end</span>
379
-
380
- <span class="ruby-keyword">if</span> <span class="ruby-keyword">defined?</span>(<span class="ruby-constant">RubyVM</span>)
381
- <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-string">&quot;--specialized-instruction&quot;</span>, <span class="ruby-string">&quot;Turn on specified instruction.&quot;</span>) <span class="ruby-keyword">do</span>
382
- <span class="ruby-identifier">options</span>.<span class="ruby-identifier">specialized_instruction</span> = <span class="ruby-keyword">true</span>
383
- <span class="ruby-keyword">end</span>
384
- <span class="ruby-keyword">end</span>
385
-
386
- <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on_tail</span>(<span class="ruby-string">&quot;-h&quot;</span>, <span class="ruby-string">&quot;--help&quot;</span>, <span class="ruby-string">&quot;Show help message&quot;</span>) <span class="ruby-keyword">do</span>
387
- <span class="ruby-identifier">puts</span> <span class="ruby-identifier">opts</span>
388
- <span class="ruby-identifier">exit</span>
389
- <span class="ruby-keyword">end</span>
390
-
391
- <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on_tail</span>(<span class="ruby-string">&quot;--version&quot;</span>, <span class="ruby-node">&quot;Show version #{RubyProf::VERSION}&quot;</span>) <span class="ruby-keyword">do</span>
392
- <span class="ruby-identifier">puts</span> <span class="ruby-string">&quot;ruby_prof &quot;</span> <span class="ruby-operator">+</span> <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">VERSION</span>
393
- <span class="ruby-identifier">exit</span>
394
- <span class="ruby-keyword">end</span>
395
-
396
- <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-string">&quot;-v&quot;</span>,<span class="ruby-string">&quot;Show version, set $VERBOSE to true, profile script if option given&quot;</span>) <span class="ruby-keyword">do</span>
397
- <span class="ruby-identifier">puts</span> <span class="ruby-string">&quot;ruby version: &quot;</span> <span class="ruby-operator">+</span> [<span class="ruby-constant">RUBY_PATCHLEVEL</span>, <span class="ruby-constant">RUBY_PLATFORM</span>, <span class="ruby-constant">RUBY_VERSION</span>].<span class="ruby-identifier">join</span>(<span class="ruby-string">&#39; &#39;</span>)
398
- <span class="ruby-identifier">$VERBOSE</span> = <span class="ruby-keyword">true</span>
399
- <span class="ruby-keyword">end</span>
400
-
401
- <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-string">&quot;-d&quot;</span>, <span class="ruby-string">&quot;Set $DEBUG to true&quot;</span>) <span class="ruby-keyword">do</span>
402
- <span class="ruby-identifier">$DEBUG</span> = <span class="ruby-keyword">true</span>
403
- <span class="ruby-keyword">end</span>
404
-
405
- <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-string">&#39;-R lib&#39;</span>, <span class="ruby-string">&#39;--require-noprof lib&#39;</span>, <span class="ruby-string">&#39;require a specific library (not profiled)&#39;</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">lib</span><span class="ruby-operator">|</span>
406
- <span class="ruby-identifier">options</span>.<span class="ruby-identifier">pre_libs</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">lib</span>
407
- <span class="ruby-keyword">end</span>
408
-
409
- <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-string">&#39;-E code&#39;</span>, <span class="ruby-string">&#39;--eval-noprof code&#39;</span>, <span class="ruby-string">&#39;execute the ruby statements (not profiled)&#39;</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">code</span><span class="ruby-operator">|</span>
410
- <span class="ruby-identifier">options</span>.<span class="ruby-identifier">pre_execs</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">code</span>
411
- <span class="ruby-keyword">end</span>
412
-
413
- <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-string">&#39;-x regexp&#39;</span>, <span class="ruby-string">&#39;--exclude regexp&#39;</span>, <span class="ruby-string">&#39;exclude methods by regexp (see method elimination)&#39;</span>) <span class="ruby-keyword">do</span><span class="ruby-operator">|</span><span class="ruby-identifier">meth</span><span class="ruby-operator">|</span>
414
- <span class="ruby-identifier">options</span>.<span class="ruby-identifier">eliminate_methods</span> <span class="ruby-operator">||=</span> []
415
- <span class="ruby-identifier">options</span>.<span class="ruby-identifier">eliminate_methods</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">meth</span>)
416
- <span class="ruby-keyword">end</span>
417
-
418
- <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-string">&#39;-X file&#39;</span>, <span class="ruby-string">&#39;--exclude-file file&#39;</span>, <span class="ruby-string">&#39;exclude methods by regexp listed in file (see method elimination)&#39;</span>) <span class="ruby-keyword">do</span><span class="ruby-operator">|</span><span class="ruby-identifier">file</span><span class="ruby-operator">|</span>
419
- <span class="ruby-identifier">options</span>.<span class="ruby-identifier">eliminate_methods_files</span> <span class="ruby-operator">||=</span> []
420
- <span class="ruby-identifier">options</span>.<span class="ruby-identifier">eliminate_methods_files</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">file</span>
421
- <span class="ruby-keyword">end</span>
422
-
423
- <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-string">&#39;--exclude-common-cycles&#39;</span>, <span class="ruby-string">&#39;make common iterators like Integer#times appear inlined&#39;</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">meth</span><span class="ruby-operator">|</span>
424
- <span class="ruby-identifier">options</span>.<span class="ruby-identifier">eliminate_methods</span> <span class="ruby-operator">||=</span> []
425
- <span class="ruby-identifier">options</span>.<span class="ruby-identifier">eliminate_methods</span> <span class="ruby-operator">+=</span> <span class="ruby-node">%w{
426
- Integer#times
427
- Integer#upto
428
- Integer#downto
429
- Enumerator#each
430
- Enumerator#each_with_index
431
- Enumerator#each_with_object
432
-
433
- Array#each
434
- Array#each_index
435
- Array#reverse_each
436
- Array#map
437
-
438
- Hash#each
439
- Hash#each_pair
440
- Hash#each_key
441
- Hash#each_value
442
-
443
- Range#each
444
- Enumerable#each_cons
445
- Enumerable#each_entry
446
- Enumerable#each_slice
447
- Enumerable#each_with_index
448
- Enumerable#each_with_object
449
- Enumerable#reverse_each
450
- Enumerable#inject
451
- Enumerable#collect
452
- Enumerable#reduce
453
- }</span>
454
- <span class="ruby-comment">#TODO: may be the whole Enumerable module should be excluded via &#39;Enumerable#.*&#39;, we need feedback on use cases.</span>
455
- <span class="ruby-keyword">end</span>
456
-
457
- <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-string">&#39;--exclude-common-callbacks&#39;</span>, <span class="ruby-string">&#39;make common callbacks invocations like Integer#times appear inlined so you can see call origins in graph&#39;</span>) <span class="ruby-keyword">do</span><span class="ruby-operator">|</span><span class="ruby-identifier">meth</span><span class="ruby-operator">|</span>
458
- <span class="ruby-identifier">options</span>.<span class="ruby-identifier">eliminate_methods</span> <span class="ruby-operator">||=</span> []
459
- <span class="ruby-identifier">options</span>.<span class="ruby-identifier">eliminate_methods</span> <span class="ruby-operator">+=</span> <span class="ruby-node">%w{
460
- Method#call
461
- Proc#call
462
- ActiveSupport::Callbacks::ClassMethods#__run_callback
463
- }</span>
464
- <span class="ruby-keyword">end</span>
465
- <span class="ruby-keyword">end</span>
466
- <span class="ruby-keyword">end</span></pre>
467
- </div>
468
-
469
- </div>
470
-
471
-
472
-
473
-
474
- </div>
475
-
476
-
477
- <div id="method-i-parse_args" class="method-detail ">
478
-
479
- <div class="method-heading">
480
- <span class="method-name">parse_args</span><span
481
- class="method-args">()</span>
482
-
483
- <span class="method-click-advice">click to toggle source</span>
484
-
485
- </div>
486
-
487
-
488
- <div class="method-description">
489
-
490
-
491
-
492
-
493
-
494
-
495
- <div class="method-source-code" id="parse_args-source">
496
- <pre><span class="ruby-comment"># File bin/ruby-prof, line 240</span>
497
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">parse_args</span>
498
- <span class="ruby-comment"># Make sure the user specified at least one file</span>
499
- <span class="ruby-keyword">if</span> <span class="ruby-constant">ARGV</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">1</span> <span class="ruby-keyword">and</span> <span class="ruby-keyword">not</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">exec</span>
500
- <span class="ruby-identifier">puts</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">option_parser</span>
501
- <span class="ruby-identifier">puts</span> <span class="ruby-string">&quot;&quot;</span>
502
- <span class="ruby-identifier">puts</span> <span class="ruby-string">&quot;Must specify a script to run&quot;</span>
503
- <span class="ruby-identifier">exit</span>(<span class="ruby-value">-1</span>)
504
- <span class="ruby-keyword">end</span>
505
-
506
- <span class="ruby-keyword">self</span>.<span class="ruby-identifier">option_parser</span>.<span class="ruby-identifier">parse!</span> <span class="ruby-constant">ARGV</span>
507
- <span class="ruby-keyword">rescue</span> <span class="ruby-constant">OptionParser</span><span class="ruby-operator">::</span><span class="ruby-constant">InvalidOption</span>, <span class="ruby-constant">OptionParser</span><span class="ruby-operator">::</span><span class="ruby-constant">InvalidArgument</span>, <span class="ruby-constant">OptionParser</span><span class="ruby-operator">::</span><span class="ruby-constant">MissingArgument</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
508
- <span class="ruby-identifier">puts</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">option_parser</span>
509
- <span class="ruby-identifier">puts</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">message</span>
510
- <span class="ruby-identifier">exit</span>(<span class="ruby-value">-1</span>)
511
- <span class="ruby-keyword">end</span></pre>
512
- </div>
513
-
514
- </div>
515
-
516
-
517
-
518
-
519
- </div>
520
-
521
-
522
- <div id="method-i-run" class="method-detail ">
523
-
524
- <div class="method-heading">
525
- <span class="method-name">run</span><span
526
- class="method-args">()</span>
527
-
528
- <span class="method-click-advice">click to toggle source</span>
529
-
530
- </div>
531
-
532
-
533
- <div class="method-description">
534
-
535
-
536
-
537
-
538
-
539
-
540
- <div class="method-source-code" id="run-source">
541
- <pre><span class="ruby-comment"># File bin/ruby-prof, line 268</span>
542
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">run</span>
543
- <span class="ruby-comment"># Get the script we will execute</span>
544
- <span class="ruby-identifier">script</span> = <span class="ruby-constant">ARGV</span>.<span class="ruby-identifier">shift</span>
545
- <span class="ruby-keyword">if</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">replace_prog_name</span>
546
- <span class="ruby-identifier">$0</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-identifier">script</span>)
547
- <span class="ruby-keyword">end</span>
548
-
549
- <span class="ruby-comment"># Set VM compile option</span>
550
- <span class="ruby-keyword">if</span> <span class="ruby-keyword">defined?</span>(<span class="ruby-constant">RubyVM</span>)
551
- <span class="ruby-constant">RubyVM</span><span class="ruby-operator">::</span><span class="ruby-constant">InstructionSequence</span>.<span class="ruby-identifier">compile_option</span> = {
552
- <span class="ruby-value">:trace_instruction</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword">true</span>,
553
- <span class="ruby-value">:specialized_instruction</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">specialized_instruction</span>
554
- }
555
- <span class="ruby-keyword">end</span>
556
-
557
- <span class="ruby-comment"># Set the measure mode</span>
558
- <span class="ruby-constant">RubyProf</span>.<span class="ruby-identifier">measure_mode</span> = <span class="ruby-identifier">options</span>.<span class="ruby-identifier">measure_mode</span>
559
- <span class="ruby-constant">RubyProf</span>.<span class="ruby-identifier">start_script</span>(<span class="ruby-identifier">script</span>)
560
- <span class="ruby-keyword">end</span></pre>
561
- </div>
562
-
563
- </div>
564
-
565
-
566
-
567
-
568
- </div>
569
-
570
-
571
- <div id="method-i-setup_options" class="method-detail ">
572
-
573
- <div class="method-heading">
574
- <span class="method-name">setup_options</span><span
575
- class="method-args">()</span>
576
-
577
- <span class="method-click-advice">click to toggle source</span>
578
-
579
- </div>
580
-
581
-
582
- <div class="method-description">
583
-
584
-
585
-
586
-
587
-
588
-
589
- <div class="method-source-code" id="setup_options-source">
590
- <pre><span class="ruby-comment"># File bin/ruby-prof, line 36</span>
591
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">setup_options</span>
592
- <span class="ruby-ivar">@options</span> = <span class="ruby-constant">OpenStruct</span>.<span class="ruby-identifier">new</span>
593
- <span class="ruby-identifier">options</span>.<span class="ruby-identifier">measure_mode</span> = <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">PROCESS_TIME</span>
594
- <span class="ruby-identifier">options</span>.<span class="ruby-identifier">printer</span> = <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">FlatPrinter</span>
595
- <span class="ruby-identifier">options</span>.<span class="ruby-identifier">min_percent</span> = <span class="ruby-value">0</span>
596
- <span class="ruby-identifier">options</span>.<span class="ruby-identifier">file</span> = <span class="ruby-keyword">nil</span>
597
- <span class="ruby-identifier">options</span>.<span class="ruby-identifier">replace_prog_name</span> = <span class="ruby-keyword">false</span>
598
- <span class="ruby-identifier">options</span>.<span class="ruby-identifier">specialized_instruction</span> = <span class="ruby-keyword">false</span>
599
-
600
- <span class="ruby-identifier">options</span>.<span class="ruby-identifier">pre_libs</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
601
- <span class="ruby-identifier">options</span>.<span class="ruby-identifier">pre_execs</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
602
- <span class="ruby-keyword">end</span></pre>
603
- </div>
604
-
605
- </div>
606
-
607
-
608
-
609
-
610
- </div>
611
-
612
-
613
- </section>
614
-
615
- </section>
616
- </main>
617
-
618
-
619
- <footer id="validator-badges" role="contentinfo">
620
- <p><a href="http://validator.w3.org/check/referer">Validate</a>
621
- <p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.0.
622
- <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
623
- </footer>
624
-