ruby-prof 0.13.1 → 1.4.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (209) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGES +579 -371
  3. data/LICENSE +24 -23
  4. data/README.rdoc +5 -433
  5. data/Rakefile +98 -110
  6. data/bin/ruby-prof +328 -329
  7. data/bin/ruby-prof-check-trace +45 -0
  8. data/ext/ruby_prof/extconf.rb +16 -59
  9. data/ext/ruby_prof/rp_aggregate_call_tree.c +59 -0
  10. data/ext/ruby_prof/rp_aggregate_call_tree.h +13 -0
  11. data/ext/ruby_prof/rp_allocation.c +287 -0
  12. data/ext/ruby_prof/rp_allocation.h +31 -0
  13. data/ext/ruby_prof/rp_call_tree.c +369 -0
  14. data/ext/ruby_prof/rp_call_tree.h +43 -0
  15. data/ext/ruby_prof/rp_call_trees.c +288 -0
  16. data/ext/ruby_prof/rp_call_trees.h +28 -0
  17. data/ext/ruby_prof/rp_measure_allocations.c +50 -65
  18. data/ext/ruby_prof/rp_measure_memory.c +42 -73
  19. data/ext/ruby_prof/rp_measure_process_time.c +65 -71
  20. data/ext/ruby_prof/rp_measure_wall_time.c +64 -42
  21. data/ext/ruby_prof/rp_measurement.c +237 -0
  22. data/ext/ruby_prof/rp_measurement.h +50 -0
  23. data/ext/ruby_prof/rp_method.c +491 -420
  24. data/ext/ruby_prof/rp_method.h +62 -57
  25. data/ext/ruby_prof/rp_profile.c +908 -0
  26. data/ext/ruby_prof/rp_profile.h +35 -0
  27. data/ext/ruby_prof/rp_stack.c +212 -128
  28. data/ext/ruby_prof/rp_stack.h +53 -51
  29. data/ext/ruby_prof/rp_thread.c +362 -268
  30. data/ext/ruby_prof/rp_thread.h +39 -27
  31. data/ext/ruby_prof/ruby_prof.c +52 -695
  32. data/ext/ruby_prof/ruby_prof.h +26 -55
  33. data/ext/ruby_prof/vc/ruby_prof.sln +28 -21
  34. data/ext/ruby_prof/vc/{ruby_prof_20.vcxproj → ruby_prof.vcxproj} +56 -8
  35. data/lib/ruby-prof.rb +52 -67
  36. data/lib/ruby-prof/assets/call_stack_printer.html.erb +710 -0
  37. data/lib/ruby-prof/assets/call_stack_printer.png +0 -0
  38. data/lib/ruby-prof/assets/graph_printer.html.erb +355 -0
  39. data/lib/ruby-prof/call_tree.rb +57 -0
  40. data/lib/ruby-prof/call_tree_visitor.rb +36 -0
  41. data/lib/ruby-prof/compatibility.rb +99 -169
  42. data/lib/ruby-prof/exclude_common_methods.rb +198 -0
  43. data/lib/ruby-prof/measurement.rb +17 -0
  44. data/lib/ruby-prof/method_info.rb +78 -131
  45. data/lib/ruby-prof/printers/abstract_printer.rb +137 -85
  46. data/lib/ruby-prof/printers/call_info_printer.rb +53 -41
  47. data/lib/ruby-prof/printers/call_stack_printer.rb +180 -773
  48. data/lib/ruby-prof/printers/call_tree_printer.rb +151 -92
  49. data/lib/ruby-prof/printers/dot_printer.rb +132 -132
  50. data/lib/ruby-prof/printers/flat_printer.rb +53 -69
  51. data/lib/ruby-prof/printers/graph_html_printer.rb +63 -255
  52. data/lib/ruby-prof/printers/graph_printer.rb +113 -116
  53. data/lib/ruby-prof/printers/multi_printer.rb +127 -56
  54. data/lib/ruby-prof/profile.rb +37 -77
  55. data/lib/ruby-prof/rack.rb +62 -15
  56. data/lib/ruby-prof/task.rb +147 -147
  57. data/lib/ruby-prof/thread.rb +10 -12
  58. data/lib/ruby-prof/version.rb +3 -0
  59. data/lib/unprof.rb +10 -10
  60. data/ruby-prof.gemspec +65 -61
  61. data/test/abstract_printer_test.rb +26 -0
  62. data/test/alias_test.rb +126 -0
  63. data/test/basic_test.rb +43 -128
  64. data/test/call_tree_visitor_test.rb +32 -0
  65. data/test/call_trees_test.rb +66 -0
  66. data/test/duplicate_names_test.rb +32 -32
  67. data/test/dynamic_method_test.rb +53 -74
  68. data/test/enumerable_test.rb +21 -16
  69. data/test/exceptions_test.rb +24 -16
  70. data/test/exclude_methods_test.rb +151 -0
  71. data/test/exclude_threads_test.rb +53 -54
  72. data/test/fiber_test.rb +129 -65
  73. data/test/gc_test.rb +90 -0
  74. data/test/inverse_call_tree_test.rb +175 -0
  75. data/test/line_number_test.rb +158 -71
  76. data/test/marshal_test.rb +113 -0
  77. data/test/measure_allocations.rb +30 -0
  78. data/test/measure_allocations_test.rb +375 -25
  79. data/test/measure_allocations_trace_test.rb +375 -0
  80. data/test/measure_memory_trace_test.rb +1101 -0
  81. data/test/measure_process_time_test.rb +785 -62
  82. data/test/measure_times.rb +56 -0
  83. data/test/measure_wall_time_test.rb +434 -254
  84. data/test/multi_printer_test.rb +71 -82
  85. data/test/no_method_class_test.rb +15 -15
  86. data/test/pause_resume_test.rb +175 -166
  87. data/test/prime.rb +54 -54
  88. data/test/prime_script.rb +6 -0
  89. data/test/printer_call_stack_test.rb +27 -0
  90. data/test/printer_call_tree_test.rb +30 -0
  91. data/test/printer_flat_test.rb +99 -0
  92. data/test/printer_graph_html_test.rb +59 -0
  93. data/test/printer_graph_test.rb +40 -0
  94. data/test/printers_test.rb +141 -257
  95. data/test/printing_recursive_graph_test.rb +81 -0
  96. data/test/profile_test.rb +16 -0
  97. data/test/rack_test.rb +93 -0
  98. data/test/recursive_test.rb +206 -215
  99. data/test/singleton_test.rb +38 -38
  100. data/test/stack_printer_test.rb +64 -78
  101. data/test/start_stop_test.rb +109 -112
  102. data/test/test_helper.rb +13 -115
  103. data/test/thread_test.rb +144 -178
  104. data/test/unique_call_path_test.rb +120 -224
  105. data/test/yarv_test.rb +56 -0
  106. metadata +77 -133
  107. data/doc/LICENSE.html +0 -155
  108. data/doc/README_rdoc.html +0 -648
  109. data/doc/Rack.html +0 -167
  110. data/doc/Rack/RubyProf.html +0 -319
  111. data/doc/RubyProf.html +0 -1000
  112. data/doc/RubyProf/AbstractPrinter.html +0 -580
  113. data/doc/RubyProf/AggregateCallInfo.html +0 -570
  114. data/doc/RubyProf/CallInfo.html +0 -512
  115. data/doc/RubyProf/CallInfoPrinter.html +0 -190
  116. data/doc/RubyProf/CallInfoVisitor.html +0 -332
  117. data/doc/RubyProf/CallStackPrinter.html +0 -1600
  118. data/doc/RubyProf/CallTreePrinter.html +0 -413
  119. data/doc/RubyProf/Cmd.html +0 -669
  120. data/doc/RubyProf/DotPrinter.html +0 -312
  121. data/doc/RubyProf/FlatPrinter.html +0 -229
  122. data/doc/RubyProf/FlatPrinterWithLineNumbers.html +0 -267
  123. data/doc/RubyProf/GraphHtmlPrinter.html +0 -630
  124. data/doc/RubyProf/GraphPrinter.html +0 -209
  125. data/doc/RubyProf/MethodInfo.html +0 -713
  126. data/doc/RubyProf/MultiPrinter.html +0 -407
  127. data/doc/RubyProf/Profile.html +0 -821
  128. data/doc/RubyProf/ProfileTask.html +0 -532
  129. data/doc/RubyProf/Test.html +0 -578
  130. data/doc/RubyProf/Thread.html +0 -262
  131. data/doc/created.rid +0 -32
  132. data/doc/examples/flat_txt.html +0 -191
  133. data/doc/examples/graph_txt.html +0 -305
  134. data/doc/images/add.png +0 -0
  135. data/doc/images/brick.png +0 -0
  136. data/doc/images/brick_link.png +0 -0
  137. data/doc/images/bug.png +0 -0
  138. data/doc/images/bullet_black.png +0 -0
  139. data/doc/images/bullet_toggle_minus.png +0 -0
  140. data/doc/images/bullet_toggle_plus.png +0 -0
  141. data/doc/images/date.png +0 -0
  142. data/doc/images/delete.png +0 -0
  143. data/doc/images/find.png +0 -0
  144. data/doc/images/loadingAnimation.gif +0 -0
  145. data/doc/images/macFFBgHack.png +0 -0
  146. data/doc/images/package.png +0 -0
  147. data/doc/images/page_green.png +0 -0
  148. data/doc/images/page_white_text.png +0 -0
  149. data/doc/images/page_white_width.png +0 -0
  150. data/doc/images/plugin.png +0 -0
  151. data/doc/images/ruby.png +0 -0
  152. data/doc/images/tag_blue.png +0 -0
  153. data/doc/images/tag_green.png +0 -0
  154. data/doc/images/transparent.png +0 -0
  155. data/doc/images/wrench.png +0 -0
  156. data/doc/images/wrench_orange.png +0 -0
  157. data/doc/images/zoom.png +0 -0
  158. data/doc/index.html +0 -647
  159. data/doc/js/darkfish.js +0 -155
  160. data/doc/js/jquery.js +0 -18
  161. data/doc/js/navigation.js +0 -142
  162. data/doc/js/search.js +0 -94
  163. data/doc/js/search_index.js +0 -1
  164. data/doc/js/searcher.js +0 -228
  165. data/doc/rdoc.css +0 -543
  166. data/doc/table_of_contents.html +0 -462
  167. data/examples/empty.png +0 -0
  168. data/examples/flat.txt +0 -55
  169. data/examples/graph.dot +0 -106
  170. data/examples/graph.html +0 -823
  171. data/examples/graph.png +0 -0
  172. data/examples/graph.txt +0 -170
  173. data/examples/minus.png +0 -0
  174. data/examples/multi.flat.txt +0 -23
  175. data/examples/multi.graph.html +0 -906
  176. data/examples/multi.grind.dat +0 -194
  177. data/examples/multi.stack.html +0 -573
  178. data/examples/plus.png +0 -0
  179. data/examples/stack.html +0 -573
  180. data/ext/ruby_prof/rp_call_info.c +0 -407
  181. data/ext/ruby_prof/rp_call_info.h +0 -48
  182. data/ext/ruby_prof/rp_measure.c +0 -48
  183. data/ext/ruby_prof/rp_measure.h +0 -45
  184. data/ext/ruby_prof/rp_measure_cpu_time.c +0 -112
  185. data/ext/ruby_prof/rp_measure_gc_runs.c +0 -65
  186. data/ext/ruby_prof/rp_measure_gc_time.c +0 -57
  187. data/ext/ruby_prof/vc/ruby_prof_18.vcxproj +0 -108
  188. data/ext/ruby_prof/vc/ruby_prof_19.vcxproj +0 -110
  189. data/ext/ruby_prof/version.h +0 -7
  190. data/lib/ruby-prof/aggregate_call_info.rb +0 -72
  191. data/lib/ruby-prof/call_info.rb +0 -89
  192. data/lib/ruby-prof/call_info_visitor.rb +0 -44
  193. data/lib/ruby-prof/images/empty.png +0 -0
  194. data/lib/ruby-prof/images/minus.png +0 -0
  195. data/lib/ruby-prof/images/plus.png +0 -0
  196. data/lib/ruby-prof/printers/flat_printer_with_line_numbers.rb +0 -57
  197. data/lib/ruby-prof/test.rb +0 -150
  198. data/test/aggregate_test.rb +0 -136
  199. data/test/call_info_test.rb +0 -78
  200. data/test/call_info_visitor_test.rb +0 -31
  201. data/test/exec_test.rb +0 -14
  202. data/test/measure_cpu_time_test.rb +0 -220
  203. data/test/measure_gc_runs_test.rb +0 -32
  204. data/test/measure_gc_time_test.rb +0 -36
  205. data/test/measure_memory_test.rb +0 -31
  206. data/test/method_elimination_test.rb +0 -84
  207. data/test/module_test.rb +0 -45
  208. data/test/stack_test.rb +0 -138
  209. data/test/test_suite.rb +0 -37
@@ -1,407 +0,0 @@
1
- <!DOCTYPE html>
2
-
3
- <html>
4
- <head>
5
- <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
6
-
7
- <title>class RubyProf::MultiPrinter - ruby-prof</title>
8
-
9
- <link type="text/css" media="screen" href="../rdoc.css" rel="stylesheet">
10
-
11
- <script type="text/javascript">
12
- var rdoc_rel_prefix = "../";
13
- </script>
14
-
15
- <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
16
- <script type="text/javascript" charset="utf-8" src="../js/navigation.js"></script>
17
- <script type="text/javascript" charset="utf-8" src="../js/search_index.js"></script>
18
- <script type="text/javascript" charset="utf-8" src="../js/search.js"></script>
19
- <script type="text/javascript" charset="utf-8" src="../js/searcher.js"></script>
20
- <script type="text/javascript" charset="utf-8" src="../js/darkfish.js"></script>
21
-
22
-
23
- <body id="top" class="class">
24
- <nav id="metadata">
25
- <nav id="home-section" class="section">
26
- <h3 class="section-header">
27
- <a href="../index.html">Home</a>
28
- <a href="../table_of_contents.html#classes">Classes</a>
29
- <a href="../table_of_contents.html#methods">Methods</a>
30
- </h3>
31
- </nav>
32
-
33
-
34
- <nav id="search-section" class="section project-section" class="initially-hidden">
35
- <form action="#" method="get" accept-charset="utf-8">
36
- <h3 class="section-header">
37
- <input type="text" name="search" placeholder="Search" id="search-field"
38
- title="Type to search, Up and Down to navigate, Enter to load">
39
- </h3>
40
- </form>
41
-
42
- <ul id="search-results" class="initially-hidden"></ul>
43
- </nav>
44
-
45
-
46
- <div id="file-metadata">
47
- <nav id="file-list-section" class="section">
48
- <h3 class="section-header">Defined In</h3>
49
- <ul>
50
- <li>lib/ruby-prof/printers/multi_printer.rb
51
- </ul>
52
- </nav>
53
-
54
-
55
- </div>
56
-
57
- <div id="class-metadata">
58
-
59
- <nav id="parent-class-section" class="section">
60
- <h3 class="section-header">Parent</h3>
61
-
62
- <p class="link">Object
63
-
64
- </nav>
65
-
66
-
67
- <!-- Method Quickref -->
68
- <nav id="method-list-section" class="section">
69
- <h3 class="section-header">Methods</h3>
70
-
71
- <ul class="link-list">
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
- </nav>
87
-
88
- </div>
89
-
90
- <div id="project-metadata">
91
- <nav id="fileindex-section" class="section project-section">
92
- <h3 class="section-header">Pages</h3>
93
-
94
- <ul>
95
-
96
- <li class="file"><a href="../LICENSE.html">LICENSE</a>
97
-
98
- <li class="file"><a href="../README_rdoc.html">README</a>
99
-
100
- <li class="file"><a href="../examples/flat_txt.html">flat</a>
101
-
102
- <li class="file"><a href="../examples/graph_txt.html">graph</a>
103
-
104
- </ul>
105
- </nav>
106
-
107
- <nav id="classindex-section" class="section project-section">
108
- <h3 class="section-header">Class and Module Index</h3>
109
-
110
- <ul class="link-list">
111
-
112
- <li><a href="../RubyProf.html">RubyProf</a>
113
-
114
- <li><a href="../RubyProf/AbstractPrinter.html">RubyProf::AbstractPrinter</a>
115
-
116
- <li><a href="../RubyProf/AggregateCallInfo.html">RubyProf::AggregateCallInfo</a>
117
-
118
- <li><a href="../RubyProf/CallInfo.html">RubyProf::CallInfo</a>
119
-
120
- <li><a href="../RubyProf/CallInfoPrinter.html">RubyProf::CallInfoPrinter</a>
121
-
122
- <li><a href="../RubyProf/CallInfoVisitor.html">RubyProf::CallInfoVisitor</a>
123
-
124
- <li><a href="../RubyProf/CallStackPrinter.html">RubyProf::CallStackPrinter</a>
125
-
126
- <li><a href="../RubyProf/CallTreePrinter.html">RubyProf::CallTreePrinter</a>
127
-
128
- <li><a href="../RubyProf/Cmd.html">RubyProf::Cmd</a>
129
-
130
- <li><a href="../RubyProf/DotPrinter.html">RubyProf::DotPrinter</a>
131
-
132
- <li><a href="../RubyProf/FlatPrinter.html">RubyProf::FlatPrinter</a>
133
-
134
- <li><a href="../RubyProf/FlatPrinterWithLineNumbers.html">RubyProf::FlatPrinterWithLineNumbers</a>
135
-
136
- <li><a href="../RubyProf/GraphHtmlPrinter.html">RubyProf::GraphHtmlPrinter</a>
137
-
138
- <li><a href="../RubyProf/GraphPrinter.html">RubyProf::GraphPrinter</a>
139
-
140
- <li><a href="../RubyProf/MethodInfo.html">RubyProf::MethodInfo</a>
141
-
142
- <li><a href="../RubyProf/MultiPrinter.html">RubyProf::MultiPrinter</a>
143
-
144
- <li><a href="../RubyProf/Profile.html">RubyProf::Profile</a>
145
-
146
- <li><a href="../RubyProf/ProfileTask.html">RubyProf::ProfileTask</a>
147
-
148
- <li><a href="../RubyProf/Test.html">RubyProf::Test</a>
149
-
150
- <li><a href="../RubyProf/Thread.html">RubyProf::Thread</a>
151
-
152
- <li><a href="../Rack.html">Rack</a>
153
-
154
- <li><a href="../Rack/RubyProf.html">Rack::RubyProf</a>
155
-
156
- </ul>
157
- </nav>
158
-
159
- </div>
160
- </nav>
161
-
162
- <div id="documentation">
163
- <h1 class="class">class RubyProf::MultiPrinter</h1>
164
-
165
- <div id="description" class="description">
166
-
167
- <p>Helper class to simplify printing profiles of several types from one
168
- profiling run. Currently prints a flat profile, a callgrind profile, a call
169
- stack profile and a graph profile.</p>
170
-
171
- </div><!-- description -->
172
-
173
-
174
-
175
-
176
- <section id="5Buntitled-5D" class="documentation-section">
177
-
178
-
179
-
180
-
181
-
182
-
183
-
184
-
185
- <!-- Methods -->
186
-
187
- <section id="public-class-5Buntitled-5D-method-details" class="method-section section">
188
- <h3 class="section-header">Public Class Methods</h3>
189
-
190
-
191
- <div id="method-c-new" class="method-detail ">
192
-
193
- <div class="method-heading">
194
- <span class="method-name">new</span><span
195
- class="method-args">(result)</span>
196
- <span class="method-click-advice">click to toggle source</span>
197
- </div>
198
-
199
-
200
- <div class="method-description">
201
-
202
-
203
-
204
-
205
-
206
- <div class="method-source-code" id="new-source">
207
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/multi_printer.rb, line 7</span>
208
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">result</span>)
209
- <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>)
210
- <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>)
211
- <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>)
212
- <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>)
213
- <span class="ruby-keyword">end</span></pre>
214
- </div><!-- new-source -->
215
-
216
- </div>
217
-
218
-
219
-
220
-
221
- </div><!-- new-method -->
222
-
223
-
224
- </section><!-- public-class-method-details -->
225
-
226
- <section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
227
- <h3 class="section-header">Public Instance Methods</h3>
228
-
229
-
230
- <div id="method-i-flat_profile" class="method-detail ">
231
-
232
- <div class="method-heading">
233
- <span class="method-name">flat_profile</span><span
234
- class="method-args">()</span>
235
- <span class="method-click-advice">click to toggle source</span>
236
- </div>
237
-
238
-
239
- <div class="method-description">
240
-
241
- <p>the name of the flat profile file</p>
242
-
243
-
244
-
245
- <div class="method-source-code" id="flat_profile-source">
246
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/multi_printer.rb, line 50</span>
247
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">flat_profile</span>
248
- <span class="ruby-node">&quot;#{@directory}/#{@profile}.flat.txt&quot;</span>
249
- <span class="ruby-keyword">end</span></pre>
250
- </div><!-- flat_profile-source -->
251
-
252
- </div>
253
-
254
-
255
-
256
-
257
- </div><!-- flat_profile-method -->
258
-
259
-
260
- <div id="method-i-graph_profile" class="method-detail ">
261
-
262
- <div class="method-heading">
263
- <span class="method-name">graph_profile</span><span
264
- class="method-args">()</span>
265
- <span class="method-click-advice">click to toggle source</span>
266
- </div>
267
-
268
-
269
- <div class="method-description">
270
-
271
- <p>the name of the graph profile file</p>
272
-
273
-
274
-
275
- <div class="method-source-code" id="graph_profile-source">
276
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/multi_printer.rb, line 40</span>
277
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">graph_profile</span>
278
- <span class="ruby-node">&quot;#{@directory}/#{@profile}.graph.html&quot;</span>
279
- <span class="ruby-keyword">end</span></pre>
280
- </div><!-- graph_profile-source -->
281
-
282
- </div>
283
-
284
-
285
-
286
-
287
- </div><!-- graph_profile-method -->
288
-
289
-
290
- <div id="method-i-print" class="method-detail ">
291
-
292
- <div class="method-heading">
293
- <span class="method-name">print</span><span
294
- class="method-args">(options)</span>
295
- <span class="method-click-advice">click to toggle source</span>
296
- </div>
297
-
298
-
299
- <div class="method-description">
300
-
301
- <p>create profile files under <a href="http://:path">options</a> or the
302
- current directory. <a href="http://:profile">options</a> is used as the
303
- base name for the pofile file, defaults to “profile”.</p>
304
-
305
-
306
-
307
- <div class="method-source-code" id="print-source">
308
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/multi_printer.rb, line 17</span>
309
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">print</span>(<span class="ruby-identifier">options</span>)
310
- <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>
311
- <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>)
312
- <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>
313
- <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>))
314
- <span class="ruby-keyword">end</span>
315
- <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>
316
- <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>)
317
- <span class="ruby-keyword">end</span>
318
- <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>
319
- <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>)
320
- <span class="ruby-keyword">end</span>
321
- <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>
322
- <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>)
323
- <span class="ruby-keyword">end</span>
324
- <span class="ruby-keyword">end</span></pre>
325
- </div><!-- print-source -->
326
-
327
- </div>
328
-
329
-
330
-
331
-
332
- </div><!-- print-method -->
333
-
334
-
335
- <div id="method-i-stack_profile" class="method-detail ">
336
-
337
- <div class="method-heading">
338
- <span class="method-name">stack_profile</span><span
339
- class="method-args">()</span>
340
- <span class="method-click-advice">click to toggle source</span>
341
- </div>
342
-
343
-
344
- <div class="method-description">
345
-
346
- <p>the name of the call stack profile file</p>
347
-
348
-
349
-
350
- <div class="method-source-code" id="stack_profile-source">
351
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/multi_printer.rb, line 35</span>
352
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">stack_profile</span>
353
- <span class="ruby-node">&quot;#{@directory}/#{@profile}.stack.html&quot;</span>
354
- <span class="ruby-keyword">end</span></pre>
355
- </div><!-- stack_profile-source -->
356
-
357
- </div>
358
-
359
-
360
-
361
-
362
- </div><!-- stack_profile-method -->
363
-
364
-
365
- <div id="method-i-tree_profile" class="method-detail ">
366
-
367
- <div class="method-heading">
368
- <span class="method-name">tree_profile</span><span
369
- class="method-args">()</span>
370
- <span class="method-click-advice">click to toggle source</span>
371
- </div>
372
-
373
-
374
- <div class="method-description">
375
-
376
- <p>the name of the callgrind profile file</p>
377
-
378
-
379
-
380
- <div class="method-source-code" id="tree_profile-source">
381
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/multi_printer.rb, line 45</span>
382
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">tree_profile</span>
383
- <span class="ruby-node">&quot;#{@directory}/#{@profile}.grind.dat&quot;</span>
384
- <span class="ruby-keyword">end</span></pre>
385
- </div><!-- tree_profile-source -->
386
-
387
- </div>
388
-
389
-
390
-
391
-
392
- </div><!-- tree_profile-method -->
393
-
394
-
395
- </section><!-- public-instance-method-details -->
396
-
397
- </section><!-- 5Buntitled-5D -->
398
-
399
- </div><!-- documentation -->
400
-
401
-
402
- <footer id="validator-badges">
403
- <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
404
- <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.1.
405
- <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
406
- </footer>
407
-
@@ -1,821 +0,0 @@
1
- <!DOCTYPE html>
2
-
3
- <html>
4
- <head>
5
- <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
6
-
7
- <title>class RubyProf::Profile - ruby-prof</title>
8
-
9
- <link type="text/css" media="screen" href="../rdoc.css" rel="stylesheet">
10
-
11
- <script type="text/javascript">
12
- var rdoc_rel_prefix = "../";
13
- </script>
14
-
15
- <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
16
- <script type="text/javascript" charset="utf-8" src="../js/navigation.js"></script>
17
- <script type="text/javascript" charset="utf-8" src="../js/search_index.js"></script>
18
- <script type="text/javascript" charset="utf-8" src="../js/search.js"></script>
19
- <script type="text/javascript" charset="utf-8" src="../js/searcher.js"></script>
20
- <script type="text/javascript" charset="utf-8" src="../js/darkfish.js"></script>
21
-
22
-
23
- <body id="top" class="class">
24
- <nav id="metadata">
25
- <nav id="home-section" class="section">
26
- <h3 class="section-header">
27
- <a href="../index.html">Home</a>
28
- <a href="../table_of_contents.html#classes">Classes</a>
29
- <a href="../table_of_contents.html#methods">Methods</a>
30
- </h3>
31
- </nav>
32
-
33
-
34
- <nav id="search-section" class="section project-section" class="initially-hidden">
35
- <form action="#" method="get" accept-charset="utf-8">
36
- <h3 class="section-header">
37
- <input type="text" name="search" placeholder="Search" id="search-field"
38
- title="Type to search, Up and Down to navigate, Enter to load">
39
- </h3>
40
- </form>
41
-
42
- <ul id="search-results" class="initially-hidden"></ul>
43
- </nav>
44
-
45
-
46
- <div id="file-metadata">
47
- <nav id="file-list-section" class="section">
48
- <h3 class="section-header">Defined In</h3>
49
- <ul>
50
- <li>lib/ruby-prof/profile.rb
51
- <li>ext/ruby_prof/ruby_prof.c
52
- </ul>
53
- </nav>
54
-
55
-
56
- </div>
57
-
58
- <div id="class-metadata">
59
-
60
- <nav id="parent-class-section" class="section">
61
- <h3 class="section-header">Parent</h3>
62
-
63
- <p class="link">Object
64
-
65
- </nav>
66
-
67
-
68
- <!-- Method Quickref -->
69
- <nav id="method-list-section" class="section">
70
- <h3 class="section-header">Methods</h3>
71
-
72
- <ul class="link-list">
73
-
74
- <li><a href="#method-c-new">::new</a>
75
-
76
- <li><a href="#method-c-profile">::profile</a>
77
-
78
- <li><a href="#method-i-detect_recursion">#detect_recursion</a>
79
-
80
- <li><a href="#method-i-eliminate_methods-21">#eliminate_methods!</a>
81
-
82
- <li><a href="#method-i-pause">#pause</a>
83
-
84
- <li><a href="#method-i-paused-3F">#paused?</a>
85
-
86
- <li><a href="#method-i-post_process">#post_process</a>
87
-
88
- <li><a href="#method-i-resume">#resume</a>
89
-
90
- <li><a href="#method-i-running-3F">#running?</a>
91
-
92
- <li><a href="#method-i-start">#start</a>
93
-
94
- <li><a href="#method-i-stop">#stop</a>
95
-
96
- <li><a href="#method-i-threads">#threads</a>
97
-
98
- </ul>
99
- </nav>
100
-
101
- </div>
102
-
103
- <div id="project-metadata">
104
- <nav id="fileindex-section" class="section project-section">
105
- <h3 class="section-header">Pages</h3>
106
-
107
- <ul>
108
-
109
- <li class="file"><a href="../LICENSE.html">LICENSE</a>
110
-
111
- <li class="file"><a href="../README_rdoc.html">README</a>
112
-
113
- <li class="file"><a href="../examples/flat_txt.html">flat</a>
114
-
115
- <li class="file"><a href="../examples/graph_txt.html">graph</a>
116
-
117
- </ul>
118
- </nav>
119
-
120
- <nav id="classindex-section" class="section project-section">
121
- <h3 class="section-header">Class and Module Index</h3>
122
-
123
- <ul class="link-list">
124
-
125
- <li><a href="../RubyProf.html">RubyProf</a>
126
-
127
- <li><a href="../RubyProf/AbstractPrinter.html">RubyProf::AbstractPrinter</a>
128
-
129
- <li><a href="../RubyProf/AggregateCallInfo.html">RubyProf::AggregateCallInfo</a>
130
-
131
- <li><a href="../RubyProf/CallInfo.html">RubyProf::CallInfo</a>
132
-
133
- <li><a href="../RubyProf/CallInfoPrinter.html">RubyProf::CallInfoPrinter</a>
134
-
135
- <li><a href="../RubyProf/CallInfoVisitor.html">RubyProf::CallInfoVisitor</a>
136
-
137
- <li><a href="../RubyProf/CallStackPrinter.html">RubyProf::CallStackPrinter</a>
138
-
139
- <li><a href="../RubyProf/CallTreePrinter.html">RubyProf::CallTreePrinter</a>
140
-
141
- <li><a href="../RubyProf/Cmd.html">RubyProf::Cmd</a>
142
-
143
- <li><a href="../RubyProf/DotPrinter.html">RubyProf::DotPrinter</a>
144
-
145
- <li><a href="../RubyProf/FlatPrinter.html">RubyProf::FlatPrinter</a>
146
-
147
- <li><a href="../RubyProf/FlatPrinterWithLineNumbers.html">RubyProf::FlatPrinterWithLineNumbers</a>
148
-
149
- <li><a href="../RubyProf/GraphHtmlPrinter.html">RubyProf::GraphHtmlPrinter</a>
150
-
151
- <li><a href="../RubyProf/GraphPrinter.html">RubyProf::GraphPrinter</a>
152
-
153
- <li><a href="../RubyProf/MethodInfo.html">RubyProf::MethodInfo</a>
154
-
155
- <li><a href="../RubyProf/MultiPrinter.html">RubyProf::MultiPrinter</a>
156
-
157
- <li><a href="../RubyProf/Profile.html">RubyProf::Profile</a>
158
-
159
- <li><a href="../RubyProf/ProfileTask.html">RubyProf::ProfileTask</a>
160
-
161
- <li><a href="../RubyProf/Test.html">RubyProf::Test</a>
162
-
163
- <li><a href="../RubyProf/Thread.html">RubyProf::Thread</a>
164
-
165
- <li><a href="../Rack.html">Rack</a>
166
-
167
- <li><a href="../Rack/RubyProf.html">Rack::RubyProf</a>
168
-
169
- </ul>
170
- </nav>
171
-
172
- </div>
173
- </nav>
174
-
175
- <div id="documentation">
176
- <h1 class="class">class RubyProf::Profile</h1>
177
-
178
- <div id="description" class="description">
179
-
180
- </div><!-- description -->
181
-
182
-
183
-
184
-
185
- <section id="5Buntitled-5D" class="documentation-section">
186
-
187
-
188
-
189
-
190
-
191
-
192
-
193
-
194
- <!-- Methods -->
195
-
196
- <section id="public-class-5Buntitled-5D-method-details" class="method-section section">
197
- <h3 class="section-header">Public Class Methods</h3>
198
-
199
-
200
- <div id="method-c-new" class="method-detail ">
201
-
202
-
203
- <div class="method-heading">
204
- <span class="method-callseq">
205
- RubyProf::Profile.new(mode, exclude_threads) &rarr; instance
206
- </span>
207
-
208
- <span class="method-click-advice">click to toggle source</span>
209
-
210
- </div>
211
-
212
-
213
-
214
- <div class="method-description">
215
-
216
- <p>Returns a new profiler.</p>
217
-
218
- <h2 id="method-c-new-label-Parameters">Parameters</h2>
219
- <dl class="rdoc-list note-list"><dt>mode
220
- <dd>
221
- <p>Measure mode (optional). Specifies the profile measure mode. If not
222
- specified, defaults to RubyProf::WALL_TIME.</p>
223
- </dd><dt>exclude_threads
224
- <dd>
225
- <p>Threads to exclude from the profiling results (optional).</p>
226
- </dd></dl>
227
-
228
-
229
-
230
- <div class="method-source-code" id="new-source">
231
- <pre>static VALUE
232
- prof_initialize(int argc, VALUE *argv, VALUE self)
233
- {
234
- prof_profile_t* profile = prof_get_profile(self);
235
- VALUE mode;
236
- prof_measure_mode_t measurer = MEASURE_WALL_TIME;
237
- VALUE exclude_threads;
238
- int i;
239
-
240
- switch (rb_scan_args(argc, argv, &quot;02&quot;, &amp;mode, &amp;exclude_threads))
241
- {
242
- case 0:
243
- {
244
- measurer = MEASURE_WALL_TIME;
245
- exclude_threads = rb_ary_new();
246
- break;
247
- }
248
- case 1:
249
- {
250
- measurer = (prof_measure_mode_t)NUM2INT(mode);
251
- exclude_threads = rb_ary_new();
252
- break;
253
- }
254
- case 2:
255
- {
256
- Check_Type(exclude_threads, T_ARRAY);
257
- measurer = (prof_measure_mode_t)NUM2INT(mode);
258
- break;
259
- }
260
- }
261
-
262
- profile-&gt;measurer = prof_get_measurer(measurer);
263
-
264
- for (i = 0; i &lt; RARRAY_LEN(exclude_threads); i++)
265
- {
266
- VALUE thread = rb_ary_entry(exclude_threads, i);
267
- VALUE thread_id = rb_obj_id(thread);
268
- st_insert(profile-&gt;exclude_threads_tbl, thread_id, Qtrue);
269
- }
270
-
271
- return self;
272
- }</pre>
273
- </div><!-- new-source -->
274
-
275
- </div>
276
-
277
-
278
-
279
-
280
- </div><!-- new-method -->
281
-
282
-
283
- <div id="method-c-profile" class="method-detail ">
284
-
285
-
286
- <div class="method-heading">
287
- <span class="method-callseq">
288
- profile {block} &rarr; RubyProf::Result
289
- </span>
290
-
291
- <span class="method-click-advice">click to toggle source</span>
292
-
293
- </div>
294
-
295
-
296
-
297
- <div class="method-description">
298
-
299
- <p>Profiles the specified block and returns a RubyProf::Result object.</p>
300
-
301
-
302
-
303
- <div class="method-source-code" id="profile-source">
304
- <pre>static VALUE
305
- prof_profile(int argc, VALUE *argv, VALUE klass)
306
- {
307
- int result;
308
- VALUE profile = rb_class_new_instance(argc, argv, cProfile);
309
-
310
- if (!rb_block_given_p())
311
- {
312
- rb_raise(rb_eArgError, &quot;A block must be provided to the profile method.&quot;);
313
- }
314
-
315
- prof_start(profile);
316
- rb_protect(rb_yield, profile, &amp;result);
317
- return prof_stop(profile);
318
- }</pre>
319
- </div><!-- profile-source -->
320
-
321
- </div>
322
-
323
-
324
-
325
-
326
- </div><!-- profile-method -->
327
-
328
-
329
- </section><!-- public-class-method-details -->
330
-
331
- <section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
332
- <h3 class="section-header">Public Instance Methods</h3>
333
-
334
-
335
- <div id="method-i-detect_recursion" class="method-detail ">
336
-
337
- <div class="method-heading">
338
- <span class="method-name">detect_recursion</span><span
339
- class="method-args">(thread)</span>
340
- <span class="method-click-advice">click to toggle source</span>
341
- </div>
342
-
343
-
344
- <div class="method-description">
345
-
346
- <p>This method detect recursive calls in the call graph.</p>
347
-
348
-
349
-
350
- <div class="method-source-code" id="detect_recursion-source">
351
- <pre><span class="ruby-comment"># File lib/ruby-prof/profile.rb, line 15</span>
352
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">detect_recursion</span>(<span class="ruby-identifier">thread</span>)
353
- <span class="ruby-identifier">visited_methods</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">hash</span>, <span class="ruby-identifier">key</span><span class="ruby-operator">|</span>
354
- <span class="ruby-identifier">hash</span>[<span class="ruby-identifier">key</span>] = <span class="ruby-value">0</span>
355
- <span class="ruby-keyword">end</span>
356
-
357
- <span class="ruby-identifier">visitor</span> = <span class="ruby-constant">CallInfoVisitor</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">thread</span>)
358
- <span class="ruby-identifier">visitor</span>.<span class="ruby-identifier">visit</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">call_info</span>, <span class="ruby-identifier">event</span><span class="ruby-operator">|</span>
359
- <span class="ruby-keyword">case</span> <span class="ruby-identifier">event</span>
360
- <span class="ruby-keyword">when</span> <span class="ruby-value">:enter</span>
361
- <span class="ruby-identifier">visited_methods</span>[<span class="ruby-identifier">call_info</span>.<span class="ruby-identifier">target</span>] <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
362
- <span class="ruby-identifier">call_info</span>.<span class="ruby-identifier">recursive</span> = (<span class="ruby-identifier">visited_methods</span>[<span class="ruby-identifier">call_info</span>.<span class="ruby-identifier">target</span>] <span class="ruby-operator">&gt;</span> <span class="ruby-value">1</span>)
363
- <span class="ruby-keyword">when</span> <span class="ruby-value">:exit</span>
364
- <span class="ruby-identifier">visited_methods</span>[<span class="ruby-identifier">call_info</span>.<span class="ruby-identifier">target</span>] <span class="ruby-operator">-=</span> <span class="ruby-value">1</span>
365
- <span class="ruby-keyword">if</span> <span class="ruby-identifier">visited_methods</span>[<span class="ruby-identifier">call_info</span>.<span class="ruby-identifier">target</span>] <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
366
- <span class="ruby-identifier">visited_methods</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">call_info</span>.<span class="ruby-identifier">target</span>)
367
- <span class="ruby-keyword">end</span>
368
- <span class="ruby-keyword">end</span>
369
- <span class="ruby-keyword">end</span>
370
- <span class="ruby-keyword">end</span></pre>
371
- </div><!-- detect_recursion-source -->
372
-
373
- </div>
374
-
375
-
376
-
377
-
378
- </div><!-- detect_recursion-method -->
379
-
380
-
381
- <div id="method-i-eliminate_methods-21" class="method-detail ">
382
-
383
- <div class="method-heading">
384
- <span class="method-name">eliminate_methods!</span><span
385
- class="method-args">(matchers)</span>
386
- <span class="method-click-advice">click to toggle source</span>
387
- </div>
388
-
389
-
390
- <div class="method-description">
391
-
392
- <p>eliminate some calls from the graph by merging the information into
393
- callers. matchers can be a list of strings or regular expressions or the
394
- name of a file containing regexps.</p>
395
-
396
-
397
-
398
- <div class="method-source-code" id="eliminate_methods-21-source">
399
- <pre><span class="ruby-comment"># File lib/ruby-prof/profile.rb, line 37</span>
400
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">eliminate_methods!</span>(<span class="ruby-identifier">matchers</span>)
401
- <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>)
402
- <span class="ruby-identifier">eliminated</span> = []
403
- <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>
404
- <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>)) }
405
- <span class="ruby-keyword">end</span>
406
- <span class="ruby-identifier">eliminated</span>
407
- <span class="ruby-keyword">end</span></pre>
408
- </div><!-- eliminate_methods-21-source -->
409
-
410
- </div>
411
-
412
-
413
-
414
-
415
- </div><!-- eliminate_methods-21-method -->
416
-
417
-
418
- <div id="method-i-pause" class="method-detail ">
419
-
420
-
421
- <div class="method-heading">
422
- <span class="method-callseq">
423
- pause &rarr; RubyProf
424
- </span>
425
-
426
- <span class="method-click-advice">click to toggle source</span>
427
-
428
- </div>
429
-
430
-
431
-
432
- <div class="method-description">
433
-
434
- <p>Pauses collecting profile data.</p>
435
-
436
-
437
-
438
- <div class="method-source-code" id="pause-source">
439
- <pre>static VALUE
440
- prof_pause(VALUE self)
441
- {
442
- prof_profile_t* profile = prof_get_profile(self);
443
- if (profile-&gt;running == Qfalse)
444
- {
445
- rb_raise(rb_eRuntimeError, &quot;RubyProf is not running.&quot;);
446
- }
447
-
448
- if (profile-&gt;paused == Qfalse)
449
- {
450
- profile-&gt;paused = Qtrue;
451
- profile-&gt;measurement_at_pause_resume = profile-&gt;measurer-&gt;measure();
452
- st_foreach(profile-&gt;threads_tbl, pause_thread, (st_data_t) profile);
453
- }
454
-
455
- return self;
456
- }</pre>
457
- </div><!-- pause-source -->
458
-
459
- </div>
460
-
461
-
462
-
463
-
464
- </div><!-- pause-method -->
465
-
466
-
467
- <div id="method-i-paused-3F" class="method-detail ">
468
-
469
-
470
- <div class="method-heading">
471
- <span class="method-callseq">
472
- paused? &rarr; boolean
473
- </span>
474
-
475
- <span class="method-click-advice">click to toggle source</span>
476
-
477
- </div>
478
-
479
-
480
-
481
- <div class="method-description">
482
-
483
- <p>Returns whether a profile is currently paused.</p>
484
-
485
-
486
-
487
- <div class="method-source-code" id="paused-3F-source">
488
- <pre>static VALUE
489
- prof_paused(VALUE self)
490
- {
491
- prof_profile_t* profile = prof_get_profile(self);
492
- return profile-&gt;paused;
493
- }</pre>
494
- </div><!-- paused-3F-source -->
495
-
496
- </div>
497
-
498
-
499
-
500
-
501
- </div><!-- paused-3F-method -->
502
-
503
-
504
- <div id="method-i-post_process" class="method-detail ">
505
-
506
- <div class="method-heading">
507
- <span class="method-name">post_process</span><span
508
- class="method-args">()</span>
509
- <span class="method-click-advice">click to toggle source</span>
510
- </div>
511
-
512
-
513
- <div class="method-description">
514
-
515
- <p>This method gets called once profiling has been completed but before
516
- results are returned to the user. Thus it provides a hook to do any
517
- necessary post-processing on the call graph.</p>
518
-
519
-
520
-
521
- <div class="method-source-code" id="post_process-source">
522
- <pre><span class="ruby-comment"># File lib/ruby-prof/profile.rb, line 8</span>
523
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">post_process</span>
524
- <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>
525
- <span class="ruby-identifier">detect_recursion</span>(<span class="ruby-identifier">thread</span>)
526
- <span class="ruby-keyword">end</span>
527
- <span class="ruby-keyword">end</span></pre>
528
- </div><!-- post_process-source -->
529
-
530
- </div>
531
-
532
-
533
-
534
-
535
- </div><!-- post_process-method -->
536
-
537
-
538
- <div id="method-i-resume" class="method-detail ">
539
-
540
-
541
- <div class="method-heading">
542
- <span class="method-callseq">
543
- resume {block} &rarr; RubyProf
544
- </span>
545
-
546
- <span class="method-click-advice">click to toggle source</span>
547
-
548
- </div>
549
-
550
-
551
-
552
- <div class="method-description">
553
-
554
- <p>Resumes recording profile data.</p>
555
-
556
-
557
-
558
- <div class="method-source-code" id="resume-source">
559
- <pre>static VALUE
560
- prof_resume(VALUE self)
561
- {
562
- prof_profile_t* profile = prof_get_profile(self);
563
- if (profile-&gt;running == Qfalse)
564
- {
565
- rb_raise(rb_eRuntimeError, &quot;RubyProf is not running.&quot;);
566
- }
567
-
568
- if (profile-&gt;paused == Qtrue)
569
- {
570
- profile-&gt;paused = Qfalse;
571
- profile-&gt;measurement_at_pause_resume = profile-&gt;measurer-&gt;measure();
572
- st_foreach(profile-&gt;threads_tbl, unpause_thread, (st_data_t) profile);
573
- }
574
-
575
- return rb_block_given_p() ? rb_ensure(rb_yield, self, prof_pause, self) : self;
576
- }</pre>
577
- </div><!-- resume-source -->
578
-
579
- </div>
580
-
581
-
582
-
583
-
584
- </div><!-- resume-method -->
585
-
586
-
587
- <div id="method-i-running-3F" class="method-detail ">
588
-
589
-
590
- <div class="method-heading">
591
- <span class="method-callseq">
592
- running? &rarr; boolean
593
- </span>
594
-
595
- <span class="method-click-advice">click to toggle source</span>
596
-
597
- </div>
598
-
599
-
600
-
601
- <div class="method-description">
602
-
603
- <p>Returns whether a profile is currently running.</p>
604
-
605
-
606
-
607
- <div class="method-source-code" id="running-3F-source">
608
- <pre>static VALUE
609
- prof_running(VALUE self)
610
- {
611
- prof_profile_t* profile = prof_get_profile(self);
612
- return profile-&gt;running;
613
- }</pre>
614
- </div><!-- running-3F-source -->
615
-
616
- </div>
617
-
618
-
619
-
620
-
621
- </div><!-- running-3F-method -->
622
-
623
-
624
- <div id="method-i-start" class="method-detail ">
625
-
626
-
627
- <div class="method-heading">
628
- <span class="method-callseq">
629
- start &rarr; RubyProf
630
- </span>
631
-
632
- <span class="method-click-advice">click to toggle source</span>
633
-
634
- </div>
635
-
636
-
637
-
638
- <div class="method-description">
639
-
640
- <p>Starts recording profile data.</p>
641
-
642
-
643
-
644
- <div class="method-source-code" id="start-source">
645
- <pre>static VALUE
646
- prof_start(VALUE self)
647
- {
648
- char* trace_file_name;
649
-
650
- prof_profile_t* profile = prof_get_profile(self);
651
-
652
- if (profile-&gt;running == Qtrue)
653
- {
654
- rb_raise(rb_eRuntimeError, &quot;RubyProf.start was already called&quot;);
655
- }
656
-
657
- #ifndef RUBY_VM
658
- if (pCurrentProfile != NULL)
659
- {
660
- rb_raise(rb_eRuntimeError, &quot;Only one profile can run at a time on Ruby 1.8.*&quot;);
661
- }
662
- #endif
663
-
664
- profile-&gt;running = Qtrue;
665
- profile-&gt;paused = Qfalse;
666
- profile-&gt;last_thread_data = NULL;
667
-
668
-
669
- /* open trace file if environment wants it */
670
- trace_file_name = getenv(&quot;RUBY_PROF_TRACE&quot;);
671
- if (trace_file_name != NULL)
672
- {
673
- if (strcmp(trace_file_name, &quot;stdout&quot;) == 0)
674
- {
675
- trace_file = stdout;
676
- }
677
- else if (strcmp(trace_file_name, &quot;stderr&quot;) == 0)
678
- {
679
- trace_file = stderr;
680
- }
681
- else
682
- {
683
- trace_file = fopen(trace_file_name, &quot;w&quot;);
684
- }
685
- }
686
-
687
- prof_install_hook(self);
688
- return self;
689
- }</pre>
690
- </div><!-- start-source -->
691
-
692
- </div>
693
-
694
-
695
-
696
-
697
- </div><!-- start-method -->
698
-
699
-
700
- <div id="method-i-stop" class="method-detail ">
701
-
702
-
703
- <div class="method-heading">
704
- <span class="method-callseq">
705
- stop &rarr; self
706
- </span>
707
-
708
- <span class="method-click-advice">click to toggle source</span>
709
-
710
- </div>
711
-
712
-
713
-
714
- <div class="method-description">
715
-
716
- <p>Stops collecting profile data.</p>
717
-
718
-
719
-
720
- <div class="method-source-code" id="stop-source">
721
- <pre>static VALUE
722
- prof_stop(VALUE self)
723
- {
724
- prof_profile_t* profile = prof_get_profile(self);
725
-
726
- if (profile-&gt;running == Qfalse)
727
- {
728
- rb_raise(rb_eRuntimeError, &quot;RubyProf.start was not yet called&quot;);
729
- }
730
-
731
- prof_remove_hook();
732
-
733
- /* close trace file if open */
734
- if (trace_file != NULL)
735
- {
736
- if (trace_file !=stderr &amp;&amp; trace_file != stdout)
737
- {
738
- #ifdef _MSC_VER
739
- _fcloseall();
740
- #else
741
- fclose(trace_file);
742
- #endif
743
- }
744
- trace_file = NULL;
745
- }
746
-
747
- prof_pop_threads(profile);
748
-
749
- /* Unset the last_thread_data (very important!)
750
- and the threads table */
751
- profile-&gt;running = profile-&gt;paused = Qfalse;
752
- profile-&gt;last_thread_data = NULL;
753
-
754
- /* Post process result */
755
- rb_funcall(self, rb_intern(&quot;post_process&quot;) , 0);
756
-
757
- return self;
758
- }</pre>
759
- </div><!-- stop-source -->
760
-
761
- </div>
762
-
763
-
764
-
765
-
766
- </div><!-- stop-method -->
767
-
768
-
769
- <div id="method-i-threads" class="method-detail ">
770
-
771
-
772
- <div class="method-heading">
773
- <span class="method-callseq">
774
- threads &rarr; Array of RubyProf::Thread
775
- </span>
776
-
777
- <span class="method-click-advice">click to toggle source</span>
778
-
779
- </div>
780
-
781
-
782
-
783
- <div class="method-description">
784
-
785
- <p>Returns an array of <a href="Thread.html">RubyProf::Thread</a> instances
786
- that were executed while the the program was being run.</p>
787
-
788
-
789
-
790
- <div class="method-source-code" id="threads-source">
791
- <pre>static VALUE
792
- prof_threads(VALUE self)
793
- {
794
- VALUE result = rb_ary_new();
795
- prof_profile_t* profile = prof_get_profile(self);
796
- st_foreach(profile-&gt;threads_tbl, collect_threads, result);
797
- return result;
798
- }</pre>
799
- </div><!-- threads-source -->
800
-
801
- </div>
802
-
803
-
804
-
805
-
806
- </div><!-- threads-method -->
807
-
808
-
809
- </section><!-- public-instance-method-details -->
810
-
811
- </section><!-- 5Buntitled-5D -->
812
-
813
- </div><!-- documentation -->
814
-
815
-
816
- <footer id="validator-badges">
817
- <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
818
- <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.1.
819
- <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
820
- </footer>
821
-