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,358 +0,0 @@
1
- <!DOCTYPE html>
2
-
3
- <html>
4
- <head>
5
- <meta charset="UTF-8">
6
-
7
- <title>class RubyProf::MultiPrinter - 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-flat_profile">#flat_profile</a>
76
-
77
- <li ><a href="#method-i-graph_profile">#graph_profile</a>
78
-
79
- <li ><a href="#method-i-print">#print</a>
80
-
81
- <li ><a href="#method-i-stack_profile">#stack_profile</a>
82
-
83
- <li ><a href="#method-i-tree_profile">#tree_profile</a>
84
-
85
- </ul>
86
- </div>
87
-
88
- </div>
89
- </nav>
90
-
91
- <main role="main" aria-labelledby="class-RubyProf::MultiPrinter">
92
- <h1 id="class-RubyProf::MultiPrinter" class="class">
93
- class RubyProf::MultiPrinter
94
- </h1>
95
-
96
- <section class="description">
97
-
98
- <p>Helper class to simplify printing profiles of several types from one
99
- profiling run. Currently prints a flat profile, a callgrind profile, a call
100
- stack profile and a graph profile.</p>
101
-
102
- </section>
103
-
104
-
105
-
106
-
107
- <section id="5Buntitled-5D" class="documentation-section">
108
-
109
-
110
-
111
-
112
-
113
-
114
-
115
-
116
-
117
- <section id="public-class-5Buntitled-5D-method-details" class="method-section">
118
- <header>
119
- <h3>Public Class Methods</h3>
120
- </header>
121
-
122
-
123
- <div id="method-c-new" class="method-detail ">
124
-
125
- <div class="method-heading">
126
- <span class="method-name">new</span><span
127
- class="method-args">(result)</span>
128
-
129
- <span class="method-click-advice">click to toggle source</span>
130
-
131
- </div>
132
-
133
-
134
- <div class="method-description">
135
-
136
-
137
-
138
-
139
-
140
-
141
- <div class="method-source-code" id="new-source">
142
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/multi_printer.rb, line 7</span>
143
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">result</span>)
144
- <span class="ruby-ivar">@stack_printer</span> = <span class="ruby-constant">CallStackPrinter</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">result</span>)
145
- <span class="ruby-ivar">@graph_printer</span> = <span class="ruby-constant">GraphHtmlPrinter</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">result</span>)
146
- <span class="ruby-ivar">@tree_printer</span> = <span class="ruby-constant">CallTreePrinter</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">result</span>)
147
- <span class="ruby-ivar">@flat_printer</span> = <span class="ruby-constant">FlatPrinter</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">result</span>)
148
- <span class="ruby-keyword">end</span></pre>
149
- </div>
150
-
151
- </div>
152
-
153
-
154
-
155
-
156
- </div>
157
-
158
-
159
- </section>
160
-
161
- <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
162
- <header>
163
- <h3>Public Instance Methods</h3>
164
- </header>
165
-
166
-
167
- <div id="method-i-flat_profile" class="method-detail ">
168
-
169
- <div class="method-heading">
170
- <span class="method-name">flat_profile</span><span
171
- class="method-args">()</span>
172
-
173
- <span class="method-click-advice">click to toggle source</span>
174
-
175
- </div>
176
-
177
-
178
- <div class="method-description">
179
-
180
- <p>the name of the flat profile file</p>
181
-
182
-
183
-
184
-
185
- <div class="method-source-code" id="flat_profile-source">
186
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/multi_printer.rb, line 50</span>
187
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">flat_profile</span>
188
- <span class="ruby-node">&quot;#{@directory}/#{@profile}.flat.txt&quot;</span>
189
- <span class="ruby-keyword">end</span></pre>
190
- </div>
191
-
192
- </div>
193
-
194
-
195
-
196
-
197
- </div>
198
-
199
-
200
- <div id="method-i-graph_profile" class="method-detail ">
201
-
202
- <div class="method-heading">
203
- <span class="method-name">graph_profile</span><span
204
- class="method-args">()</span>
205
-
206
- <span class="method-click-advice">click to toggle source</span>
207
-
208
- </div>
209
-
210
-
211
- <div class="method-description">
212
-
213
- <p>the name of the graph profile file</p>
214
-
215
-
216
-
217
-
218
- <div class="method-source-code" id="graph_profile-source">
219
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/multi_printer.rb, line 40</span>
220
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">graph_profile</span>
221
- <span class="ruby-node">&quot;#{@directory}/#{@profile}.graph.html&quot;</span>
222
- <span class="ruby-keyword">end</span></pre>
223
- </div>
224
-
225
- </div>
226
-
227
-
228
-
229
-
230
- </div>
231
-
232
-
233
- <div id="method-i-print" class="method-detail ">
234
-
235
- <div class="method-heading">
236
- <span class="method-name">print</span><span
237
- class="method-args">(options)</span>
238
-
239
- <span class="method-click-advice">click to toggle source</span>
240
-
241
- </div>
242
-
243
-
244
- <div class="method-description">
245
-
246
- <p>create profile files under <a href=":path">options</a> or the current
247
- directory. <a href=":profile">options</a> is used as the base name for the
248
- pofile file, defaults to “profile”.</p>
249
-
250
-
251
-
252
-
253
- <div class="method-source-code" id="print-source">
254
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/multi_printer.rb, line 17</span>
255
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">print</span>(<span class="ruby-identifier">options</span>)
256
- <span class="ruby-ivar">@profile</span> = <span class="ruby-identifier">options</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value">:profile</span>) <span class="ruby-operator">||</span> <span class="ruby-string">&quot;profile&quot;</span>
257
- <span class="ruby-ivar">@directory</span> = <span class="ruby-identifier">options</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value">:path</span>) <span class="ruby-operator">||</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-string">&quot;.&quot;</span>)
258
- <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">stack_profile</span>, <span class="ruby-string">&quot;w&quot;</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span>
259
- <span class="ruby-ivar">@stack_printer</span>.<span class="ruby-identifier">print</span>(<span class="ruby-identifier">f</span>, <span class="ruby-identifier">options</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-value">:graph</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-node">&quot;#{@profile}.graph.html&quot;</span>))
260
- <span class="ruby-keyword">end</span>
261
- <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">graph_profile</span>, <span class="ruby-string">&quot;w&quot;</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span>
262
- <span class="ruby-ivar">@graph_printer</span>.<span class="ruby-identifier">print</span>(<span class="ruby-identifier">f</span>, <span class="ruby-identifier">options</span>)
263
- <span class="ruby-keyword">end</span>
264
- <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">tree_profile</span>, <span class="ruby-string">&quot;w&quot;</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span>
265
- <span class="ruby-ivar">@tree_printer</span>.<span class="ruby-identifier">print</span>(<span class="ruby-identifier">f</span>, <span class="ruby-identifier">options</span>)
266
- <span class="ruby-keyword">end</span>
267
- <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">flat_profile</span>, <span class="ruby-string">&quot;w&quot;</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span>
268
- <span class="ruby-ivar">@flat_printer</span>.<span class="ruby-identifier">print</span>(<span class="ruby-identifier">f</span>, <span class="ruby-identifier">options</span>)
269
- <span class="ruby-keyword">end</span>
270
- <span class="ruby-keyword">end</span></pre>
271
- </div>
272
-
273
- </div>
274
-
275
-
276
-
277
-
278
- </div>
279
-
280
-
281
- <div id="method-i-stack_profile" class="method-detail ">
282
-
283
- <div class="method-heading">
284
- <span class="method-name">stack_profile</span><span
285
- class="method-args">()</span>
286
-
287
- <span class="method-click-advice">click to toggle source</span>
288
-
289
- </div>
290
-
291
-
292
- <div class="method-description">
293
-
294
- <p>the name of the call stack profile file</p>
295
-
296
-
297
-
298
-
299
- <div class="method-source-code" id="stack_profile-source">
300
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/multi_printer.rb, line 35</span>
301
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">stack_profile</span>
302
- <span class="ruby-node">&quot;#{@directory}/#{@profile}.stack.html&quot;</span>
303
- <span class="ruby-keyword">end</span></pre>
304
- </div>
305
-
306
- </div>
307
-
308
-
309
-
310
-
311
- </div>
312
-
313
-
314
- <div id="method-i-tree_profile" class="method-detail ">
315
-
316
- <div class="method-heading">
317
- <span class="method-name">tree_profile</span><span
318
- class="method-args">()</span>
319
-
320
- <span class="method-click-advice">click to toggle source</span>
321
-
322
- </div>
323
-
324
-
325
- <div class="method-description">
326
-
327
- <p>the name of the callgrind profile file</p>
328
-
329
-
330
-
331
-
332
- <div class="method-source-code" id="tree_profile-source">
333
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/multi_printer.rb, line 45</span>
334
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">tree_profile</span>
335
- <span class="ruby-node">&quot;#{@directory}/#{@profile}.grind.dat&quot;</span>
336
- <span class="ruby-keyword">end</span></pre>
337
- </div>
338
-
339
- </div>
340
-
341
-
342
-
343
-
344
- </div>
345
-
346
-
347
- </section>
348
-
349
- </section>
350
- </main>
351
-
352
-
353
- <footer id="validator-badges" role="contentinfo">
354
- <p><a href="http://validator.w3.org/check/referer">Validate</a>
355
- <p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.0.
356
- <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
357
- </footer>
358
-
@@ -1,713 +0,0 @@
1
- <!DOCTYPE html>
2
-
3
- <html>
4
- <head>
5
- <meta charset="UTF-8">
6
-
7
- <title>class RubyProf::Profile - 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-c-profile">::profile</a>
76
-
77
- <li ><a href="#method-i-eliminate_methods-21">#eliminate_methods!</a>
78
-
79
- <li ><a href="#method-i-pause">#pause</a>
80
-
81
- <li ><a href="#method-i-paused-3F">#paused?</a>
82
-
83
- <li ><a href="#method-i-post_process">#post_process</a>
84
-
85
- <li ><a href="#method-i-resume">#resume</a>
86
-
87
- <li ><a href="#method-i-running-3F">#running?</a>
88
-
89
- <li ><a href="#method-i-start">#start</a>
90
-
91
- <li ><a href="#method-i-stop">#stop</a>
92
-
93
- <li ><a href="#method-i-threads">#threads</a>
94
-
95
- </ul>
96
- </div>
97
-
98
- </div>
99
- </nav>
100
-
101
- <main role="main" aria-labelledby="class-RubyProf::Profile">
102
- <h1 id="class-RubyProf::Profile" class="class">
103
- class RubyProf::Profile
104
- </h1>
105
-
106
- <section class="description">
107
-
108
- </section>
109
-
110
-
111
-
112
-
113
- <section id="5Buntitled-5D" class="documentation-section">
114
-
115
-
116
-
117
-
118
-
119
-
120
-
121
-
122
-
123
- <section id="public-class-5Buntitled-5D-method-details" class="method-section">
124
- <header>
125
- <h3>Public Class Methods</h3>
126
- </header>
127
-
128
-
129
- <div id="method-c-new" class="method-detail ">
130
-
131
-
132
- <div class="method-heading">
133
- <span class="method-callseq">
134
- RubyProf::Profile.new(mode, exclude_threads) &rarr; instance
135
- </span>
136
-
137
- <span class="method-click-advice">click to toggle source</span>
138
-
139
- </div>
140
-
141
-
142
-
143
- <div class="method-description">
144
-
145
- <p>Returns a new profiler.</p>
146
-
147
- <h2 id="method-c-new-label-Parameters">Parameters<span><a href="#method-c-new-label-Parameters">&para;</a> <a href="#top">&uarr;</a></span></h2>
148
- <dl class="rdoc-list note-list"><dt>mode
149
- <dd>
150
- <p>Measure mode (optional). Specifies the profile measure mode. If not
151
- specified, defaults to RubyProf::WALL_TIME.</p>
152
- </dd><dt>exclude_threads
153
- <dd>
154
- <p>Threads to exclude from the profiling results (optional).</p>
155
- </dd></dl>
156
-
157
-
158
-
159
-
160
- <div class="method-source-code" id="new-source">
161
- <pre>static VALUE
162
- prof_initialize(int argc, VALUE *argv, VALUE self)
163
- {
164
- prof_profile_t* profile = prof_get_profile(self);
165
- VALUE mode;
166
- prof_measure_mode_t measurer = MEASURE_WALL_TIME;
167
- VALUE exclude_threads;
168
- int i;
169
-
170
- switch (rb_scan_args(argc, argv, &quot;02&quot;, &amp;mode, &amp;exclude_threads))
171
- {
172
- case 0:
173
- {
174
- measurer = MEASURE_WALL_TIME;
175
- exclude_threads = rb_ary_new();
176
- break;
177
- }
178
- case 1:
179
- {
180
- measurer = (prof_measure_mode_t)NUM2INT(mode);
181
- exclude_threads = rb_ary_new();
182
- break;
183
- }
184
- case 2:
185
- {
186
- Check_Type(exclude_threads, T_ARRAY);
187
- measurer = (prof_measure_mode_t)NUM2INT(mode);
188
- break;
189
- }
190
- }
191
-
192
- profile-&gt;measurer = prof_get_measurer(measurer);
193
-
194
- for (i = 0; i &lt; RARRAY_LEN(exclude_threads); i++)
195
- {
196
- VALUE thread = rb_ary_entry(exclude_threads, i);
197
- VALUE thread_id = rb_obj_id(thread);
198
- st_insert(profile-&gt;exclude_threads_tbl, thread_id, Qtrue);
199
- }
200
-
201
- return self;
202
- }</pre>
203
- </div>
204
-
205
- </div>
206
-
207
-
208
-
209
-
210
- </div>
211
-
212
-
213
- <div id="method-c-profile" class="method-detail ">
214
-
215
-
216
- <div class="method-heading">
217
- <span class="method-callseq">
218
- profile {block} &rarr; RubyProf::Result
219
- </span>
220
-
221
- <span class="method-click-advice">click to toggle source</span>
222
-
223
- </div>
224
-
225
-
226
-
227
- <div class="method-description">
228
-
229
- <p>Profiles the specified block and returns a RubyProf::Result object.</p>
230
-
231
-
232
-
233
-
234
- <div class="method-source-code" id="profile-source">
235
- <pre>static VALUE
236
- prof_profile(int argc, VALUE *argv, VALUE klass)
237
- {
238
- int result;
239
- VALUE profile = rb_class_new_instance(argc, argv, cProfile);
240
-
241
- if (!rb_block_given_p())
242
- {
243
- rb_raise(rb_eArgError, &quot;A block must be provided to the profile method.&quot;);
244
- }
245
-
246
- prof_start(profile);
247
- rb_protect(rb_yield, profile, &amp;result);
248
- return prof_stop(profile);
249
- }</pre>
250
- </div>
251
-
252
- </div>
253
-
254
-
255
-
256
-
257
- </div>
258
-
259
-
260
- </section>
261
-
262
- <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
263
- <header>
264
- <h3>Public Instance Methods</h3>
265
- </header>
266
-
267
-
268
- <div id="method-i-eliminate_methods-21" class="method-detail ">
269
-
270
- <div class="method-heading">
271
- <span class="method-name">eliminate_methods!</span><span
272
- class="method-args">(matchers)</span>
273
-
274
- <span class="method-click-advice">click to toggle source</span>
275
-
276
- </div>
277
-
278
-
279
- <div class="method-description">
280
-
281
- <p>eliminate some calls from the graph by merging the information into
282
- callers. matchers can be a list of strings or regular expressions or the
283
- name of a file containing regexps.</p>
284
-
285
-
286
-
287
-
288
- <div class="method-source-code" id="eliminate_methods-21-source">
289
- <pre><span class="ruby-comment"># File lib/ruby-prof/profile.rb, line 16</span>
290
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">eliminate_methods!</span>(<span class="ruby-identifier">matchers</span>)
291
- <span class="ruby-identifier">matchers</span> = <span class="ruby-identifier">read_regexps_from_file</span>(<span class="ruby-identifier">matchers</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">matchers</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>)
292
- <span class="ruby-identifier">eliminated</span> = []
293
- <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>
294
- <span class="ruby-identifier">matchers</span>.<span class="ruby-identifier">each</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">matcher</span><span class="ruby-operator">|</span> <span class="ruby-identifier">eliminated</span>.<span class="ruby-identifier">concat</span>(<span class="ruby-identifier">eliminate_methods</span>(<span class="ruby-identifier">thread</span>.<span class="ruby-identifier">methods</span>, <span class="ruby-identifier">matcher</span>)) }
295
- <span class="ruby-keyword">end</span>
296
- <span class="ruby-identifier">eliminated</span>
297
- <span class="ruby-keyword">end</span></pre>
298
- </div>
299
-
300
- </div>
301
-
302
-
303
-
304
-
305
- </div>
306
-
307
-
308
- <div id="method-i-pause" class="method-detail ">
309
-
310
-
311
- <div class="method-heading">
312
- <span class="method-callseq">
313
- pause &rarr; RubyProf
314
- </span>
315
-
316
- <span class="method-click-advice">click to toggle source</span>
317
-
318
- </div>
319
-
320
-
321
-
322
- <div class="method-description">
323
-
324
- <p>Pauses collecting profile data.</p>
325
-
326
-
327
-
328
-
329
- <div class="method-source-code" id="pause-source">
330
- <pre>static VALUE
331
- prof_pause(VALUE self)
332
- {
333
- prof_profile_t* profile = prof_get_profile(self);
334
- if (profile-&gt;running == Qfalse)
335
- {
336
- rb_raise(rb_eRuntimeError, &quot;RubyProf is not running.&quot;);
337
- }
338
-
339
- if (profile-&gt;paused == Qfalse)
340
- {
341
- profile-&gt;paused = Qtrue;
342
- profile-&gt;measurement_at_pause_resume = profile-&gt;measurer-&gt;measure();
343
- st_foreach(profile-&gt;threads_tbl, pause_thread, (st_data_t) profile);
344
- }
345
-
346
- return self;
347
- }</pre>
348
- </div>
349
-
350
- </div>
351
-
352
-
353
-
354
-
355
- </div>
356
-
357
-
358
- <div id="method-i-paused-3F" class="method-detail ">
359
-
360
-
361
- <div class="method-heading">
362
- <span class="method-callseq">
363
- paused? &rarr; boolean
364
- </span>
365
-
366
- <span class="method-click-advice">click to toggle source</span>
367
-
368
- </div>
369
-
370
-
371
-
372
- <div class="method-description">
373
-
374
- <p>Returns whether a profile is currently paused.</p>
375
-
376
-
377
-
378
-
379
- <div class="method-source-code" id="paused-3F-source">
380
- <pre>static VALUE
381
- prof_paused(VALUE self)
382
- {
383
- prof_profile_t* profile = prof_get_profile(self);
384
- return profile-&gt;paused;
385
- }</pre>
386
- </div>
387
-
388
- </div>
389
-
390
-
391
-
392
-
393
- </div>
394
-
395
-
396
- <div id="method-i-post_process" class="method-detail ">
397
-
398
- <div class="method-heading">
399
- <span class="method-name">post_process</span><span
400
- class="method-args">()</span>
401
-
402
- <span class="method-click-advice">click to toggle source</span>
403
-
404
- </div>
405
-
406
-
407
- <div class="method-description">
408
-
409
- <p>This method gets called once profiling has been completed but before
410
- results are returned to the user. Thus it provides a hook to do any
411
- necessary post-processing on the call graph.</p>
412
-
413
-
414
-
415
-
416
- <div class="method-source-code" id="post_process-source">
417
- <pre><span class="ruby-comment"># File lib/ruby-prof/profile.rb, line 8</span>
418
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">post_process</span>
419
- <span class="ruby-keyword">self</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>
420
- <span class="ruby-identifier">thread</span>.<span class="ruby-identifier">detect_recursion</span>
421
- <span class="ruby-keyword">end</span>
422
- <span class="ruby-keyword">end</span></pre>
423
- </div>
424
-
425
- </div>
426
-
427
-
428
-
429
-
430
- </div>
431
-
432
-
433
- <div id="method-i-resume" class="method-detail ">
434
-
435
-
436
- <div class="method-heading">
437
- <span class="method-callseq">
438
- resume {block} &rarr; RubyProf
439
- </span>
440
-
441
- <span class="method-click-advice">click to toggle source</span>
442
-
443
- </div>
444
-
445
-
446
-
447
- <div class="method-description">
448
-
449
- <p>Resumes recording profile data.</p>
450
-
451
-
452
-
453
-
454
- <div class="method-source-code" id="resume-source">
455
- <pre>static VALUE
456
- prof_resume(VALUE self)
457
- {
458
- prof_profile_t* profile = prof_get_profile(self);
459
- if (profile-&gt;running == Qfalse)
460
- {
461
- rb_raise(rb_eRuntimeError, &quot;RubyProf is not running.&quot;);
462
- }
463
-
464
- if (profile-&gt;paused == Qtrue)
465
- {
466
- profile-&gt;paused = Qfalse;
467
- profile-&gt;measurement_at_pause_resume = profile-&gt;measurer-&gt;measure();
468
- st_foreach(profile-&gt;threads_tbl, unpause_thread, (st_data_t) profile);
469
- }
470
-
471
- return rb_block_given_p() ? rb_ensure(rb_yield, self, prof_pause, self) : self;
472
- }</pre>
473
- </div>
474
-
475
- </div>
476
-
477
-
478
-
479
-
480
- </div>
481
-
482
-
483
- <div id="method-i-running-3F" class="method-detail ">
484
-
485
-
486
- <div class="method-heading">
487
- <span class="method-callseq">
488
- running? &rarr; boolean
489
- </span>
490
-
491
- <span class="method-click-advice">click to toggle source</span>
492
-
493
- </div>
494
-
495
-
496
-
497
- <div class="method-description">
498
-
499
- <p>Returns whether a profile is currently running.</p>
500
-
501
-
502
-
503
-
504
- <div class="method-source-code" id="running-3F-source">
505
- <pre>static VALUE
506
- prof_running(VALUE self)
507
- {
508
- prof_profile_t* profile = prof_get_profile(self);
509
- return profile-&gt;running;
510
- }</pre>
511
- </div>
512
-
513
- </div>
514
-
515
-
516
-
517
-
518
- </div>
519
-
520
-
521
- <div id="method-i-start" class="method-detail ">
522
-
523
-
524
- <div class="method-heading">
525
- <span class="method-callseq">
526
- start &rarr; RubyProf
527
- </span>
528
-
529
- <span class="method-click-advice">click to toggle source</span>
530
-
531
- </div>
532
-
533
-
534
-
535
- <div class="method-description">
536
-
537
- <p>Starts recording profile data.</p>
538
-
539
-
540
-
541
-
542
- <div class="method-source-code" id="start-source">
543
- <pre>static VALUE
544
- prof_start(VALUE self)
545
- {
546
- char* trace_file_name;
547
-
548
- prof_profile_t* profile = prof_get_profile(self);
549
-
550
- if (profile-&gt;running == Qtrue)
551
- {
552
- rb_raise(rb_eRuntimeError, &quot;RubyProf.start was already called&quot;);
553
- }
554
-
555
- profile-&gt;running = Qtrue;
556
- profile-&gt;paused = Qfalse;
557
- profile-&gt;last_thread_data = NULL;
558
-
559
-
560
- /* open trace file if environment wants it */
561
- trace_file_name = getenv(&quot;RUBY_PROF_TRACE&quot;);
562
- if (trace_file_name != NULL)
563
- {
564
- if (strcmp(trace_file_name, &quot;stdout&quot;) == 0)
565
- {
566
- trace_file = stdout;
567
- }
568
- else if (strcmp(trace_file_name, &quot;stderr&quot;) == 0)
569
- {
570
- trace_file = stderr;
571
- }
572
- else
573
- {
574
- trace_file = fopen(trace_file_name, &quot;w&quot;);
575
- }
576
- }
577
-
578
- prof_install_hook(self);
579
- return self;
580
- }</pre>
581
- </div>
582
-
583
- </div>
584
-
585
-
586
-
587
-
588
- </div>
589
-
590
-
591
- <div id="method-i-stop" class="method-detail ">
592
-
593
-
594
- <div class="method-heading">
595
- <span class="method-callseq">
596
- stop &rarr; self
597
- </span>
598
-
599
- <span class="method-click-advice">click to toggle source</span>
600
-
601
- </div>
602
-
603
-
604
-
605
- <div class="method-description">
606
-
607
- <p>Stops collecting profile data.</p>
608
-
609
-
610
-
611
-
612
- <div class="method-source-code" id="stop-source">
613
- <pre>static VALUE
614
- prof_stop(VALUE self)
615
- {
616
- prof_profile_t* profile = prof_get_profile(self);
617
-
618
- if (profile-&gt;running == Qfalse)
619
- {
620
- rb_raise(rb_eRuntimeError, &quot;RubyProf.start was not yet called&quot;);
621
- }
622
-
623
- prof_remove_hook();
624
-
625
- /* close trace file if open */
626
- if (trace_file != NULL)
627
- {
628
- if (trace_file !=stderr &amp;&amp; trace_file != stdout)
629
- {
630
- #ifdef _MSC_VER
631
- _fcloseall();
632
- #else
633
- fclose(trace_file);
634
- #endif
635
- }
636
- trace_file = NULL;
637
- }
638
-
639
- prof_pop_threads(profile);
640
-
641
- /* Unset the last_thread_data (very important!)
642
- and the threads table */
643
- profile-&gt;running = profile-&gt;paused = Qfalse;
644
- profile-&gt;last_thread_data = NULL;
645
-
646
- /* Post process result */
647
- rb_funcall(self, rb_intern(&quot;post_process&quot;) , 0);
648
-
649
- return self;
650
- }</pre>
651
- </div>
652
-
653
- </div>
654
-
655
-
656
-
657
-
658
- </div>
659
-
660
-
661
- <div id="method-i-threads" class="method-detail ">
662
-
663
-
664
- <div class="method-heading">
665
- <span class="method-callseq">
666
- threads &rarr; Array of RubyProf::Thread
667
- </span>
668
-
669
- <span class="method-click-advice">click to toggle source</span>
670
-
671
- </div>
672
-
673
-
674
-
675
- <div class="method-description">
676
-
677
- <p>Returns an array of <a href="Thread.html">RubyProf::Thread</a> instances
678
- that were executed while the the program was being run.</p>
679
-
680
-
681
-
682
-
683
- <div class="method-source-code" id="threads-source">
684
- <pre>static VALUE
685
- prof_threads(VALUE self)
686
- {
687
- VALUE result = rb_ary_new();
688
- prof_profile_t* profile = prof_get_profile(self);
689
- st_foreach(profile-&gt;threads_tbl, collect_threads, result);
690
- return result;
691
- }</pre>
692
- </div>
693
-
694
- </div>
695
-
696
-
697
-
698
-
699
- </div>
700
-
701
-
702
- </section>
703
-
704
- </section>
705
- </main>
706
-
707
-
708
- <footer id="validator-badges" role="contentinfo">
709
- <p><a href="http://validator.w3.org/check/referer">Validate</a>
710
- <p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.0.
711
- <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
712
- </footer>
713
-