ruby-prof 0.15.7 → 0.15.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES +5 -0
  3. data/doc/created.rid +4 -4
  4. data/doc/js/search_index.js.gz +0 -0
  5. data/examples/graph.dot +53 -75
  6. data/examples/multi.flat.txt +21 -21
  7. data/examples/multi.graph.html +693 -839
  8. data/examples/multi.grind.dat +93 -173
  9. data/examples/multi.stack.html +411 -437
  10. data/examples/stack.html +411 -437
  11. data/lib/ruby-prof/assets/call_stack_printer.css.html +117 -0
  12. data/lib/ruby-prof/assets/call_stack_printer.js.html +385 -0
  13. data/lib/ruby-prof/assets/call_stack_printer.png +0 -0
  14. data/lib/ruby-prof/printers/flat_printer.rb +1 -1
  15. data/lib/ruby-prof/printers/graph_html_printer.rb +43 -48
  16. data/lib/ruby-prof/version.rb +1 -1
  17. data/ruby-prof.gemspec +1 -1
  18. data/test/measure_memory_test.rb +5 -3
  19. data/test/printers_test.rb +1 -1
  20. metadata +5 -58
  21. data/doc/LICENSE.html +0 -114
  22. data/doc/README_rdoc.html +0 -592
  23. data/doc/Rack.html +0 -95
  24. data/doc/Rack/RubyProf.html +0 -264
  25. data/doc/RubyProf.html +0 -961
  26. data/doc/RubyProf/AbstractPrinter.html +0 -546
  27. data/doc/RubyProf/AggregateCallInfo.html +0 -537
  28. data/doc/RubyProf/CallInfo.html +0 -716
  29. data/doc/RubyProf/CallInfoPrinter.html +0 -120
  30. data/doc/RubyProf/CallInfoVisitor.html +0 -198
  31. data/doc/RubyProf/CallStackPrinter.html +0 -1121
  32. data/doc/RubyProf/CallTreePrinter.html +0 -359
  33. data/doc/RubyProf/Cmd.html +0 -631
  34. data/doc/RubyProf/DotPrinter.html +0 -257
  35. data/doc/RubyProf/FlatPrinter.html +0 -163
  36. data/doc/RubyProf/FlatPrinterWithLineNumbers.html +0 -208
  37. data/doc/RubyProf/GraphHtmlPrinter.html +0 -579
  38. data/doc/RubyProf/GraphPrinter.html +0 -139
  39. data/doc/RubyProf/MethodInfo.html +0 -885
  40. data/doc/RubyProf/MultiPrinter.html +0 -358
  41. data/doc/RubyProf/Profile.html +0 -713
  42. data/doc/RubyProf/ProfileTask.html +0 -490
  43. data/doc/RubyProf/Thread.html +0 -303
  44. data/doc/examples/flat_txt.html +0 -149
  45. data/doc/examples/graph_html.html +0 -850
  46. data/doc/examples/graph_txt.html +0 -274
  47. data/doc/images/add.png +0 -0
  48. data/doc/images/arrow_up.png +0 -0
  49. data/doc/images/brick.png +0 -0
  50. data/doc/images/brick_link.png +0 -0
  51. data/doc/images/bug.png +0 -0
  52. data/doc/images/bullet_black.png +0 -0
  53. data/doc/images/bullet_toggle_minus.png +0 -0
  54. data/doc/images/bullet_toggle_plus.png +0 -0
  55. data/doc/images/date.png +0 -0
  56. data/doc/images/delete.png +0 -0
  57. data/doc/images/find.png +0 -0
  58. data/doc/images/macFFBgHack.png +0 -0
  59. data/doc/images/package.png +0 -0
  60. data/doc/images/page_green.png +0 -0
  61. data/doc/images/page_white_text.png +0 -0
  62. data/doc/images/page_white_width.png +0 -0
  63. data/doc/images/plugin.png +0 -0
  64. data/doc/images/ruby.png +0 -0
  65. data/doc/images/tag_blue.png +0 -0
  66. data/doc/images/tag_green.png +0 -0
  67. data/doc/images/transparent.png +0 -0
  68. data/doc/images/wrench.png +0 -0
  69. data/doc/images/wrench_orange.png +0 -0
  70. data/doc/images/zoom.png +0 -0
  71. data/doc/index.html +0 -618
  72. data/doc/table_of_contents.html +0 -934
  73. data/examples/empty.png +0 -0
  74. data/examples/graph.png +0 -0
  75. data/examples/minus.png +0 -0
  76. data/examples/plus.png +0 -0
@@ -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,631 +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 269</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 263</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 48</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>, <span class="ruby-value">:multi</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-string">&#39; multi - Creates several reports in output directory&#39;</span>
295
- ) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">printer</span><span class="ruby-operator">|</span>
296
-
297
-
298
- <span class="ruby-keyword">case</span> <span class="ruby-identifier">printer</span>
299
- <span class="ruby-keyword">when</span> <span class="ruby-value">:flat</span>
300
- <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>
301
- <span class="ruby-keyword">when</span> <span class="ruby-value">:flat_with_line_numbers</span>
302
- <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>
303
- <span class="ruby-keyword">when</span> <span class="ruby-value">:graph</span>
304
- <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>
305
- <span class="ruby-keyword">when</span> <span class="ruby-value">:graph_html</span>
306
- <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>
307
- <span class="ruby-keyword">when</span> <span class="ruby-value">:call_tree</span>
308
- <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>
309
- <span class="ruby-keyword">when</span> <span class="ruby-value">:call_stack</span>
310
- <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>
311
- <span class="ruby-keyword">when</span> <span class="ruby-value">:dot</span>
312
- <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>
313
- <span class="ruby-keyword">when</span> <span class="ruby-value">:multi</span>
314
- <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">MultiPrinter</span>
315
- <span class="ruby-keyword">end</span>
316
- <span class="ruby-keyword">end</span>
317
-
318
- <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>,
319
- <span class="ruby-string">&#39;The minimum percent a method must take before &#39;</span>,
320
- <span class="ruby-string">&#39; being included in output reports.&#39;</span>,
321
- <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>
322
- <span class="ruby-identifier">options</span>.<span class="ruby-identifier">min_percent</span> = <span class="ruby-identifier">min_percent</span>
323
- <span class="ruby-keyword">end</span>
324
-
325
- <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>,
326
- <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>
327
- <span class="ruby-identifier">options</span>.<span class="ruby-identifier">file</span> = <span class="ruby-identifier">file</span>
328
- <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>
329
- <span class="ruby-keyword">end</span>
330
-
331
- <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-string">&#39;--mode=measure_mode&#39;</span>,
332
- [<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>],
333
- <span class="ruby-string">&#39;Select what ruby-prof should measure:&#39;</span>,
334
- <span class="ruby-string">&#39; process - Process time (default).&#39;</span>,
335
- <span class="ruby-string">&#39; wall - Wall time.&#39;</span>,
336
- <span class="ruby-string">&#39; cpu - CPU time (Pentium and PowerPCs only).&#39;</span>,
337
- <span class="ruby-string">&#39; allocations - Object allocations (requires patched Ruby interpreter).&#39;</span>,
338
- <span class="ruby-string">&#39; memory - Allocated memory in KB (requires patched Ruby interpreter).&#39;</span>,
339
- <span class="ruby-string">&#39; gc_runs - Number of garbage collections (requires patched Ruby interpreter).&#39;</span>,
340
- <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>
341
-
342
- <span class="ruby-keyword">case</span> <span class="ruby-identifier">measure_mode</span>
343
- <span class="ruby-keyword">when</span> <span class="ruby-value">:process</span>
344
- <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>
345
- <span class="ruby-keyword">when</span> <span class="ruby-value">:wall</span>
346
- <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>
347
- <span class="ruby-keyword">when</span> <span class="ruby-value">:cpu</span>
348
- <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>
349
- <span class="ruby-keyword">when</span> <span class="ruby-value">:allocations</span>
350
- <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>
351
- <span class="ruby-keyword">when</span> <span class="ruby-value">:memory</span>
352
- <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>
353
- <span class="ruby-keyword">when</span> <span class="ruby-value">:gc_runs</span>
354
- <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>
355
- <span class="ruby-keyword">when</span> <span class="ruby-value">:gc_time</span>
356
- <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>
357
- <span class="ruby-keyword">end</span>
358
- <span class="ruby-keyword">end</span>
359
-
360
- <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>],
361
- <span class="ruby-string">&#39;Select how ruby-prof results should be sorted:&#39;</span>,
362
- <span class="ruby-string">&#39; total - Total time&#39;</span>,
363
- <span class="ruby-string">&#39; self - Self time&#39;</span>,
364
- <span class="ruby-string">&#39; wait - Wait time&#39;</span>,
365
- <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>
366
-
367
- <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>
368
- <span class="ruby-keyword">when</span> <span class="ruby-value">:total</span>
369
- <span class="ruby-value">:total_time</span>
370
- <span class="ruby-keyword">when</span> <span class="ruby-value">:self</span>
371
- <span class="ruby-value">:self_time</span>
372
- <span class="ruby-keyword">when</span> <span class="ruby-value">:wait</span>
373
- <span class="ruby-value">:wait_time</span>
374
- <span class="ruby-keyword">when</span> <span class="ruby-value">:child</span>
375
- <span class="ruby-value">:children_time</span>
376
- <span class="ruby-keyword">end</span>
377
- <span class="ruby-keyword">end</span>
378
-
379
- <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>
380
- <span class="ruby-identifier">options</span>.<span class="ruby-identifier">replace_prog_name</span> = <span class="ruby-keyword">true</span>
381
- <span class="ruby-keyword">end</span>
382
-
383
- <span class="ruby-keyword">if</span> <span class="ruby-keyword">defined?</span>(<span class="ruby-constant">RubyVM</span>)
384
- <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>
385
- <span class="ruby-identifier">options</span>.<span class="ruby-identifier">specialized_instruction</span> = <span class="ruby-keyword">true</span>
386
- <span class="ruby-keyword">end</span>
387
- <span class="ruby-keyword">end</span>
388
-
389
- <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>
390
- <span class="ruby-identifier">puts</span> <span class="ruby-identifier">opts</span>
391
- <span class="ruby-identifier">exit</span>
392
- <span class="ruby-keyword">end</span>
393
-
394
- <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>
395
- <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>
396
- <span class="ruby-identifier">exit</span>
397
- <span class="ruby-keyword">end</span>
398
-
399
- <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>
400
- <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>)
401
- <span class="ruby-identifier">$VERBOSE</span> = <span class="ruby-keyword">true</span>
402
- <span class="ruby-keyword">end</span>
403
-
404
- <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>
405
- <span class="ruby-identifier">$DEBUG</span> = <span class="ruby-keyword">true</span>
406
- <span class="ruby-keyword">end</span>
407
-
408
- <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>
409
- <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>
410
- <span class="ruby-keyword">end</span>
411
-
412
- <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>
413
- <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>
414
- <span class="ruby-keyword">end</span>
415
-
416
- <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>
417
- <span class="ruby-identifier">options</span>.<span class="ruby-identifier">eliminate_methods</span> <span class="ruby-operator">||=</span> []
418
- <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>)
419
- <span class="ruby-keyword">end</span>
420
-
421
- <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>
422
- <span class="ruby-identifier">options</span>.<span class="ruby-identifier">eliminate_methods_files</span> <span class="ruby-operator">||=</span> []
423
- <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>
424
- <span class="ruby-keyword">end</span>
425
-
426
- <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>
427
- <span class="ruby-identifier">options</span>.<span class="ruby-identifier">eliminate_methods</span> <span class="ruby-operator">||=</span> []
428
- <span class="ruby-identifier">options</span>.<span class="ruby-identifier">eliminate_methods</span> <span class="ruby-operator">+=</span> <span class="ruby-node">%w{
429
- Integer#times
430
- Integer#upto
431
- Integer#downto
432
- Enumerator#each
433
- Enumerator#each_with_index
434
- Enumerator#each_with_object
435
-
436
- Array#each
437
- Array#each_index
438
- Array#reverse_each
439
- Array#map
440
-
441
- Hash#each
442
- Hash#each_pair
443
- Hash#each_key
444
- Hash#each_value
445
-
446
- Range#each
447
- Enumerable#each_cons
448
- Enumerable#each_entry
449
- Enumerable#each_slice
450
- Enumerable#each_with_index
451
- Enumerable#each_with_object
452
- Enumerable#reverse_each
453
- Enumerable#inject
454
- Enumerable#collect
455
- Enumerable#reduce
456
- }</span>
457
- <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>
458
- <span class="ruby-keyword">end</span>
459
-
460
- <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>
461
- <span class="ruby-identifier">options</span>.<span class="ruby-identifier">eliminate_methods</span> <span class="ruby-operator">||=</span> []
462
- <span class="ruby-identifier">options</span>.<span class="ruby-identifier">eliminate_methods</span> <span class="ruby-operator">+=</span> <span class="ruby-node">%w{
463
- Method#call
464
- Proc#call
465
- ActiveSupport::Callbacks::ClassMethods#__run_callback
466
- }</span>
467
- <span class="ruby-keyword">end</span>
468
- <span class="ruby-keyword">end</span>
469
- <span class="ruby-keyword">end</span></pre>
470
- </div>
471
-
472
- </div>
473
-
474
-
475
-
476
-
477
- </div>
478
-
479
-
480
- <div id="method-i-parse_args" class="method-detail ">
481
-
482
- <div class="method-heading">
483
- <span class="method-name">parse_args</span><span
484
- class="method-args">()</span>
485
-
486
- <span class="method-click-advice">click to toggle source</span>
487
-
488
- </div>
489
-
490
-
491
- <div class="method-description">
492
-
493
-
494
-
495
-
496
-
497
-
498
- <div class="method-source-code" id="parse_args-source">
499
- <pre><span class="ruby-comment"># File bin/ruby-prof, line 242</span>
500
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">parse_args</span>
501
- <span class="ruby-comment"># Make sure the user specified at least one file</span>
502
- <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>
503
- <span class="ruby-identifier">puts</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">option_parser</span>
504
- <span class="ruby-identifier">puts</span> <span class="ruby-string">&quot;&quot;</span>
505
- <span class="ruby-identifier">puts</span> <span class="ruby-string">&quot;Must specify a script to run&quot;</span>
506
- <span class="ruby-identifier">exit</span>(<span class="ruby-value">-1</span>)
507
- <span class="ruby-keyword">end</span>
508
-
509
- <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>
510
-
511
- <span class="ruby-keyword">if</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">printer</span> <span class="ruby-operator">==</span> <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">MultiPrinter</span>
512
- <span class="ruby-identifier">options</span>.<span class="ruby-identifier">file</span> <span class="ruby-operator">||=</span> <span class="ruby-string">&quot;.&quot;</span>
513
- <span class="ruby-identifier">options</span>.<span class="ruby-identifier">old_wd</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">pwd</span>
514
- <span class="ruby-keyword">end</span>
515
- <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>
516
- <span class="ruby-identifier">puts</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">option_parser</span>
517
- <span class="ruby-identifier">puts</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">message</span>
518
- <span class="ruby-identifier">exit</span>(<span class="ruby-value">-1</span>)
519
- <span class="ruby-keyword">end</span></pre>
520
- </div>
521
-
522
- </div>
523
-
524
-
525
-
526
-
527
- </div>
528
-
529
-
530
- <div id="method-i-run" class="method-detail ">
531
-
532
- <div class="method-heading">
533
- <span class="method-name">run</span><span
534
- class="method-args">()</span>
535
-
536
- <span class="method-click-advice">click to toggle source</span>
537
-
538
- </div>
539
-
540
-
541
- <div class="method-description">
542
-
543
-
544
-
545
-
546
-
547
-
548
- <div class="method-source-code" id="run-source">
549
- <pre><span class="ruby-comment"># File bin/ruby-prof, line 275</span>
550
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">run</span>
551
- <span class="ruby-comment"># Get the script we will execute</span>
552
- <span class="ruby-identifier">script</span> = <span class="ruby-constant">ARGV</span>.<span class="ruby-identifier">shift</span>
553
- <span class="ruby-keyword">if</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">replace_prog_name</span>
554
- <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>)
555
- <span class="ruby-keyword">end</span>
556
-
557
- <span class="ruby-comment"># Set VM compile option</span>
558
- <span class="ruby-keyword">if</span> <span class="ruby-keyword">defined?</span>(<span class="ruby-constant">RubyVM</span>)
559
- <span class="ruby-constant">RubyVM</span><span class="ruby-operator">::</span><span class="ruby-constant">InstructionSequence</span>.<span class="ruby-identifier">compile_option</span> = {
560
- <span class="ruby-value">:trace_instruction</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword">true</span>,
561
- <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>
562
- }
563
- <span class="ruby-keyword">end</span>
564
-
565
- <span class="ruby-comment"># Set the measure mode</span>
566
- <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> <span class="ruby-keyword">if</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">measure_mode</span>
567
- <span class="ruby-constant">RubyProf</span>.<span class="ruby-identifier">start_script</span>(<span class="ruby-identifier">script</span>)
568
- <span class="ruby-keyword">end</span></pre>
569
- </div>
570
-
571
- </div>
572
-
573
-
574
-
575
-
576
- </div>
577
-
578
-
579
- <div id="method-i-setup_options" class="method-detail ">
580
-
581
- <div class="method-heading">
582
- <span class="method-name">setup_options</span><span
583
- class="method-args">()</span>
584
-
585
- <span class="method-click-advice">click to toggle source</span>
586
-
587
- </div>
588
-
589
-
590
- <div class="method-description">
591
-
592
-
593
-
594
-
595
-
596
-
597
- <div class="method-source-code" id="setup_options-source">
598
- <pre><span class="ruby-comment"># File bin/ruby-prof, line 36</span>
599
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">setup_options</span>
600
- <span class="ruby-ivar">@options</span> = <span class="ruby-constant">OpenStruct</span>.<span class="ruby-identifier">new</span>
601
- <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>
602
- <span class="ruby-identifier">options</span>.<span class="ruby-identifier">min_percent</span> = <span class="ruby-value">0</span>
603
- <span class="ruby-identifier">options</span>.<span class="ruby-identifier">file</span> = <span class="ruby-keyword">nil</span>
604
- <span class="ruby-identifier">options</span>.<span class="ruby-identifier">replace_prog_name</span> = <span class="ruby-keyword">false</span>
605
- <span class="ruby-identifier">options</span>.<span class="ruby-identifier">specialized_instruction</span> = <span class="ruby-keyword">false</span>
606
-
607
- <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>
608
- <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>
609
- <span class="ruby-keyword">end</span></pre>
610
- </div>
611
-
612
- </div>
613
-
614
-
615
-
616
-
617
- </div>
618
-
619
-
620
- </section>
621
-
622
- </section>
623
- </main>
624
-
625
-
626
- <footer id="validator-badges" role="contentinfo">
627
- <p><a href="http://validator.w3.org/check/referer">Validate</a>
628
- <p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.0.
629
- <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
630
- </footer>
631
-