ruby-prof 0.16.2 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/CHANGES +532 -467
- data/LICENSE +24 -24
- data/README.rdoc +5 -454
- data/Rakefile +110 -113
- data/bin/ruby-prof +380 -340
- data/bin/ruby-prof-check-trace +45 -45
- data/ext/ruby_prof/extconf.rb +36 -64
- data/ext/ruby_prof/rp_allocation.c +279 -0
- data/ext/ruby_prof/rp_allocation.h +31 -0
- data/ext/ruby_prof/rp_call_info.c +271 -407
- data/ext/ruby_prof/rp_call_info.h +35 -48
- data/ext/ruby_prof/rp_measure_allocations.c +52 -76
- data/ext/ruby_prof/rp_measure_memory.c +42 -77
- data/ext/ruby_prof/rp_measure_process_time.c +67 -71
- data/ext/ruby_prof/rp_measure_wall_time.c +62 -45
- data/ext/ruby_prof/rp_measurement.c +230 -0
- data/ext/ruby_prof/rp_measurement.h +50 -0
- data/ext/ruby_prof/rp_method.c +630 -411
- data/ext/ruby_prof/rp_method.h +70 -52
- data/ext/ruby_prof/rp_profile.c +895 -0
- data/ext/ruby_prof/rp_profile.h +37 -0
- data/ext/ruby_prof/rp_stack.c +196 -128
- data/ext/ruby_prof/rp_stack.h +56 -51
- data/ext/ruby_prof/rp_thread.c +337 -273
- data/ext/ruby_prof/rp_thread.h +36 -27
- data/ext/ruby_prof/ruby_prof.c +48 -671
- data/ext/ruby_prof/ruby_prof.h +17 -56
- data/ext/ruby_prof/vc/ruby_prof.sln +20 -21
- data/ext/ruby_prof/vc/{ruby_prof_20.vcxproj → ruby_prof.vcxproj} +38 -5
- data/lib/ruby-prof.rb +52 -58
- data/lib/ruby-prof/assets/call_stack_printer.html.erb +713 -0
- data/lib/ruby-prof/assets/call_stack_printer.png +0 -0
- data/lib/ruby-prof/assets/graph_printer.html.erb +356 -0
- data/lib/ruby-prof/call_info.rb +57 -126
- data/lib/ruby-prof/call_info_visitor.rb +38 -40
- data/lib/ruby-prof/compatibility.rb +109 -178
- data/lib/ruby-prof/exclude_common_methods.rb +198 -0
- data/lib/ruby-prof/measurement.rb +14 -0
- data/lib/ruby-prof/method_info.rb +90 -129
- data/lib/ruby-prof/printers/abstract_printer.rb +127 -85
- data/lib/ruby-prof/printers/call_info_printer.rb +51 -41
- data/lib/ruby-prof/printers/call_stack_printer.rb +182 -260
- data/lib/ruby-prof/printers/call_tree_printer.rb +151 -130
- data/lib/ruby-prof/printers/dot_printer.rb +132 -132
- data/lib/ruby-prof/printers/flat_printer.rb +52 -70
- data/lib/ruby-prof/printers/graph_html_printer.rb +63 -244
- data/lib/ruby-prof/printers/graph_printer.rb +114 -116
- data/lib/ruby-prof/printers/multi_printer.rb +127 -58
- data/lib/ruby-prof/profile.rb +33 -55
- data/lib/ruby-prof/rack.rb +171 -95
- data/lib/ruby-prof/task.rb +147 -147
- data/lib/ruby-prof/thread.rb +35 -41
- data/lib/ruby-prof/version.rb +3 -3
- data/lib/unprof.rb +10 -10
- data/ruby-prof.gemspec +58 -57
- data/test/abstract_printer_test.rb +26 -0
- data/test/alias_test.rb +129 -0
- data/test/basic_test.rb +129 -128
- data/test/call_info_visitor_test.rb +31 -31
- data/test/duplicate_names_test.rb +32 -32
- data/test/dynamic_method_test.rb +53 -55
- data/test/enumerable_test.rb +21 -21
- data/test/exceptions_test.rb +24 -16
- data/test/exclude_methods_test.rb +146 -0
- data/test/exclude_threads_test.rb +53 -53
- data/test/fiber_test.rb +73 -79
- data/test/gc_test.rb +96 -0
- data/test/line_number_test.rb +161 -71
- data/test/marshal_test.rb +119 -0
- data/test/measure_allocations.rb +30 -0
- data/test/measure_allocations_test.rb +385 -26
- data/test/measure_allocations_trace_test.rb +385 -0
- data/test/measure_memory_trace_test.rb +756 -0
- data/test/measure_process_time_test.rb +849 -63
- data/test/measure_times.rb +54 -0
- data/test/measure_wall_time_test.rb +459 -255
- data/test/multi_printer_test.rb +71 -83
- data/test/no_method_class_test.rb +15 -15
- data/test/parser_timings.rb +24 -0
- data/test/pause_resume_test.rb +166 -166
- data/test/prime.rb +56 -54
- data/test/printer_call_stack_test.rb +28 -0
- data/test/printer_call_tree_test.rb +31 -0
- data/test/printer_flat_test.rb +68 -0
- data/test/printer_graph_html_test.rb +60 -0
- data/test/printer_graph_test.rb +41 -0
- data/test/printers_test.rb +141 -255
- data/test/printing_recursive_graph_test.rb +81 -127
- data/test/rack_test.rb +157 -93
- data/test/recursive_test.rb +210 -215
- data/test/singleton_test.rb +38 -38
- data/test/stack_printer_test.rb +64 -78
- data/test/start_stop_test.rb +109 -112
- data/test/test_helper.rb +24 -264
- data/test/thread_test.rb +144 -187
- data/test/unique_call_path_test.rb +190 -202
- data/test/yarv_test.rb +56 -55
- metadata +34 -114
- data/doc/LICENSE.html +0 -114
- data/doc/README_rdoc.html +0 -603
- data/doc/Rack.html +0 -95
- data/doc/Rack/RubyProf.html +0 -226
- data/doc/RubyProf.html +0 -962
- data/doc/RubyProf/AbstractPrinter.html +0 -546
- data/doc/RubyProf/AggregateCallInfo.html +0 -551
- data/doc/RubyProf/CallInfo.html +0 -639
- data/doc/RubyProf/CallInfoPrinter.html +0 -120
- data/doc/RubyProf/CallInfoVisitor.html +0 -198
- data/doc/RubyProf/CallStackPrinter.html +0 -1121
- data/doc/RubyProf/CallTreePrinter.html +0 -641
- data/doc/RubyProf/Cmd.html +0 -631
- data/doc/RubyProf/DotPrinter.html +0 -257
- data/doc/RubyProf/FlatPrinter.html +0 -163
- data/doc/RubyProf/FlatPrinterWithLineNumbers.html +0 -208
- data/doc/RubyProf/GraphHtmlPrinter.html +0 -552
- data/doc/RubyProf/GraphPrinter.html +0 -139
- data/doc/RubyProf/MethodInfo.html +0 -745
- data/doc/RubyProf/MultiPrinter.html +0 -360
- data/doc/RubyProf/Profile.html +0 -763
- data/doc/RubyProf/ProfileTask.html +0 -490
- data/doc/RubyProf/Thread.html +0 -310
- data/doc/created.rid +0 -31
- data/doc/css/fonts.css +0 -167
- data/doc/css/rdoc.css +0 -590
- data/doc/examples/flat_txt.html +0 -138
- data/doc/examples/graph_html.html +0 -909
- data/doc/examples/graph_txt.html +0 -247
- data/doc/fonts/Lato-Light.ttf +0 -0
- data/doc/fonts/Lato-LightItalic.ttf +0 -0
- data/doc/fonts/Lato-Regular.ttf +0 -0
- data/doc/fonts/Lato-RegularItalic.ttf +0 -0
- data/doc/fonts/SourceCodePro-Bold.ttf +0 -0
- data/doc/fonts/SourceCodePro-Regular.ttf +0 -0
- data/doc/images/add.png +0 -0
- data/doc/images/arrow_up.png +0 -0
- data/doc/images/brick.png +0 -0
- data/doc/images/brick_link.png +0 -0
- data/doc/images/bug.png +0 -0
- data/doc/images/bullet_black.png +0 -0
- data/doc/images/bullet_toggle_minus.png +0 -0
- data/doc/images/bullet_toggle_plus.png +0 -0
- data/doc/images/date.png +0 -0
- data/doc/images/delete.png +0 -0
- data/doc/images/find.png +0 -0
- data/doc/images/loadingAnimation.gif +0 -0
- data/doc/images/macFFBgHack.png +0 -0
- data/doc/images/package.png +0 -0
- data/doc/images/page_green.png +0 -0
- data/doc/images/page_white_text.png +0 -0
- data/doc/images/page_white_width.png +0 -0
- data/doc/images/plugin.png +0 -0
- data/doc/images/ruby.png +0 -0
- data/doc/images/tag_blue.png +0 -0
- data/doc/images/tag_green.png +0 -0
- data/doc/images/transparent.png +0 -0
- data/doc/images/wrench.png +0 -0
- data/doc/images/wrench_orange.png +0 -0
- data/doc/images/zoom.png +0 -0
- data/doc/index.html +0 -626
- data/doc/js/darkfish.js +0 -161
- data/doc/js/jquery.js +0 -4
- data/doc/js/navigation.js +0 -142
- data/doc/js/navigation.js.gz +0 -0
- data/doc/js/search.js +0 -109
- data/doc/js/search_index.js +0 -1
- data/doc/js/search_index.js.gz +0 -0
- data/doc/js/searcher.js +0 -228
- data/doc/js/searcher.js.gz +0 -0
- data/doc/table_of_contents.html +0 -942
- data/examples/cachegrind.out.1 +0 -114
- data/examples/cachegrind.out.1.32313213 +0 -114
- data/examples/flat.txt +0 -50
- data/examples/graph.dot +0 -84
- data/examples/graph.html +0 -823
- data/examples/graph.txt +0 -139
- data/examples/multi.flat.txt +0 -23
- data/examples/multi.graph.html +0 -760
- data/examples/multi.grind.dat +0 -114
- data/examples/multi.stack.html +0 -547
- data/examples/stack.html +0 -547
- data/ext/ruby_prof/rp_measure.c +0 -40
- data/ext/ruby_prof/rp_measure.h +0 -45
- data/ext/ruby_prof/rp_measure_cpu_time.c +0 -136
- data/ext/ruby_prof/rp_measure_gc_runs.c +0 -73
- data/ext/ruby_prof/rp_measure_gc_time.c +0 -60
- data/ext/ruby_prof/vc/ruby_prof_18.vcxproj +0 -108
- data/ext/ruby_prof/vc/ruby_prof_19.vcxproj +0 -110
- data/lib/ruby-prof/aggregate_call_info.rb +0 -76
- data/lib/ruby-prof/assets/call_stack_printer.css.html +0 -117
- data/lib/ruby-prof/assets/call_stack_printer.js.html +0 -385
- data/lib/ruby-prof/printers/flat_printer_with_line_numbers.rb +0 -64
- data/test/aggregate_test.rb +0 -136
- data/test/block_test.rb +0 -74
- data/test/call_info_test.rb +0 -78
- data/test/issue137_test.rb +0 -63
- data/test/measure_cpu_time_test.rb +0 -213
- data/test/measure_gc_runs_test.rb +0 -32
- data/test/measure_gc_time_test.rb +0 -36
- data/test/measure_memory_test.rb +0 -33
- data/test/method_elimination_test.rb +0 -84
- data/test/module_test.rb +0 -45
- data/test/stack_test.rb +0 -138
@@ -1,360 +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 52</span>
|
187
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">flat_profile</span>
|
188
|
-
<span class="ruby-node">"#{@directory}/#{@profile}.flat.txt"</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 42</span>
|
220
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">graph_profile</span>
|
221
|
-
<span class="ruby-node">"#{@directory}/#{@profile}.graph.html"</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">"profile"</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">"."</span>)
|
258
|
-
|
259
|
-
<span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">stack_profile</span>, <span class="ruby-string">"w"</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span>
|
260
|
-
<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">></span> <span class="ruby-node">"#{@profile}.graph.html"</span>))
|
261
|
-
<span class="ruby-keyword">end</span>
|
262
|
-
|
263
|
-
<span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">graph_profile</span>, <span class="ruby-string">"w"</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span>
|
264
|
-
<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>)
|
265
|
-
<span class="ruby-keyword">end</span>
|
266
|
-
|
267
|
-
<span class="ruby-ivar">@tree_printer</span>.<span class="ruby-identifier">print</span>(<span class="ruby-identifier">options</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-value">:path</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@directory</span>, <span class="ruby-value">:profile</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@profile</span>))
|
268
|
-
|
269
|
-
<span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">flat_profile</span>, <span class="ruby-string">"w"</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span>
|
270
|
-
<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>)
|
271
|
-
<span class="ruby-keyword">end</span>
|
272
|
-
<span class="ruby-keyword">end</span></pre>
|
273
|
-
</div>
|
274
|
-
|
275
|
-
</div>
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
</div>
|
281
|
-
|
282
|
-
|
283
|
-
<div id="method-i-stack_profile" class="method-detail ">
|
284
|
-
|
285
|
-
<div class="method-heading">
|
286
|
-
<span class="method-name">stack_profile</span><span
|
287
|
-
class="method-args">()</span>
|
288
|
-
|
289
|
-
<span class="method-click-advice">click to toggle source</span>
|
290
|
-
|
291
|
-
</div>
|
292
|
-
|
293
|
-
|
294
|
-
<div class="method-description">
|
295
|
-
|
296
|
-
<p>the name of the call stack profile file</p>
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
<div class="method-source-code" id="stack_profile-source">
|
302
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/printers/multi_printer.rb, line 37</span>
|
303
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">stack_profile</span>
|
304
|
-
<span class="ruby-node">"#{@directory}/#{@profile}.stack.html"</span>
|
305
|
-
<span class="ruby-keyword">end</span></pre>
|
306
|
-
</div>
|
307
|
-
|
308
|
-
</div>
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
</div>
|
314
|
-
|
315
|
-
|
316
|
-
<div id="method-i-tree_profile" class="method-detail ">
|
317
|
-
|
318
|
-
<div class="method-heading">
|
319
|
-
<span class="method-name">tree_profile</span><span
|
320
|
-
class="method-args">()</span>
|
321
|
-
|
322
|
-
<span class="method-click-advice">click to toggle source</span>
|
323
|
-
|
324
|
-
</div>
|
325
|
-
|
326
|
-
|
327
|
-
<div class="method-description">
|
328
|
-
|
329
|
-
<p>the name of the callgrind profile file</p>
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
<div class="method-source-code" id="tree_profile-source">
|
335
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/printers/multi_printer.rb, line 47</span>
|
336
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">tree_profile</span>
|
337
|
-
<span class="ruby-node">"#{@directory}/#{@profile}.callgrind.out.#{$$}"</span>
|
338
|
-
<span class="ruby-keyword">end</span></pre>
|
339
|
-
</div>
|
340
|
-
|
341
|
-
</div>
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
</div>
|
347
|
-
|
348
|
-
|
349
|
-
</section>
|
350
|
-
|
351
|
-
</section>
|
352
|
-
</main>
|
353
|
-
|
354
|
-
|
355
|
-
<footer id="validator-badges" role="contentinfo">
|
356
|
-
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
357
|
-
<p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.2.
|
358
|
-
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
359
|
-
</footer>
|
360
|
-
|
data/doc/RubyProf/Profile.html
DELETED
@@ -1,763 +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
|
-
new()
|
135
|
-
</span>
|
136
|
-
|
137
|
-
<span class="method-click-advice">click to toggle source</span>
|
138
|
-
|
139
|
-
</div>
|
140
|
-
|
141
|
-
<div class="method-heading">
|
142
|
-
<span class="method-callseq">
|
143
|
-
new(options)
|
144
|
-
</span>
|
145
|
-
|
146
|
-
</div>
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
<div class="method-description">
|
151
|
-
|
152
|
-
<p>Returns a new profiler. Possible options for the options hash are:</p>
|
153
|
-
<dl class="rdoc-list note-list"><dt>measure_mode
|
154
|
-
<dd>
|
155
|
-
<p>Measure mode. Specifies the profile measure mode. If not specified,
|
156
|
-
defaults to RubyProf::WALL_TIME.</p>
|
157
|
-
</dd><dt>exclude_threads
|
158
|
-
<dd>
|
159
|
-
<p>Threads to exclude from the profiling results.</p>
|
160
|
-
</dd><dt>include_threads
|
161
|
-
<dd>
|
162
|
-
<p>Focus profiling on only the given threads. This will ignore all other
|
163
|
-
threads.</p>
|
164
|
-
</dd><dt>merge_fibers
|
165
|
-
<dd>
|
166
|
-
<p>Whether to merge all fibers under a given thread. This should be used when
|
167
|
-
profiling for a callgrind printer.</p>
|
168
|
-
</dd></dl>
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
<div class="method-source-code" id="new-source">
|
174
|
-
<pre>static VALUE
|
175
|
-
prof_initialize(int argc, VALUE *argv, VALUE self)
|
176
|
-
{
|
177
|
-
prof_profile_t* profile = prof_get_profile(self);
|
178
|
-
VALUE mode_or_options;
|
179
|
-
VALUE mode = Qnil;
|
180
|
-
VALUE exclude_threads = Qnil;
|
181
|
-
VALUE include_threads = Qnil;
|
182
|
-
VALUE merge_fibers = Qnil;
|
183
|
-
int i;
|
184
|
-
|
185
|
-
switch (rb_scan_args(argc, argv, "02", &mode_or_options, &exclude_threads)) {
|
186
|
-
case 0:
|
187
|
-
break;
|
188
|
-
case 1:
|
189
|
-
if (FIXNUM_P(mode_or_options)) {
|
190
|
-
mode = mode_or_options;
|
191
|
-
}
|
192
|
-
else {
|
193
|
-
Check_Type(mode_or_options, T_HASH);
|
194
|
-
mode = rb_hash_aref(mode_or_options, ID2SYM(rb_intern("measure_mode")));
|
195
|
-
merge_fibers = rb_hash_aref(mode_or_options, ID2SYM(rb_intern("merge_fibers")));
|
196
|
-
exclude_threads = rb_hash_aref(mode_or_options, ID2SYM(rb_intern("exclude_threads")));
|
197
|
-
include_threads = rb_hash_aref(mode_or_options, ID2SYM(rb_intern("include_threads")));
|
198
|
-
}
|
199
|
-
break;
|
200
|
-
case 2:
|
201
|
-
Check_Type(exclude_threads, T_ARRAY);
|
202
|
-
break;
|
203
|
-
}
|
204
|
-
|
205
|
-
if (mode == Qnil) {
|
206
|
-
mode = INT2NUM(MEASURE_WALL_TIME);
|
207
|
-
} else {
|
208
|
-
Check_Type(mode, T_FIXNUM);
|
209
|
-
}
|
210
|
-
profile->measurer = prof_get_measurer(NUM2INT(mode));
|
211
|
-
profile->merge_fibers = merge_fibers != Qnil && merge_fibers != Qfalse;
|
212
|
-
|
213
|
-
if (exclude_threads != Qnil) {
|
214
|
-
Check_Type(exclude_threads, T_ARRAY);
|
215
|
-
assert(profile->exclude_threads_tbl == NULL);
|
216
|
-
profile->exclude_threads_tbl = threads_table_create();
|
217
|
-
for (i = 0; i < RARRAY_LEN(exclude_threads); i++) {
|
218
|
-
VALUE thread = rb_ary_entry(exclude_threads, i);
|
219
|
-
VALUE thread_id = rb_obj_id(thread);
|
220
|
-
st_insert(profile->exclude_threads_tbl, thread_id, Qtrue);
|
221
|
-
}
|
222
|
-
}
|
223
|
-
|
224
|
-
if (include_threads != Qnil) {
|
225
|
-
Check_Type(include_threads, T_ARRAY);
|
226
|
-
assert(profile->include_threads_tbl == NULL);
|
227
|
-
profile->include_threads_tbl = threads_table_create();
|
228
|
-
for (i = 0; i < RARRAY_LEN(include_threads); i++) {
|
229
|
-
VALUE thread = rb_ary_entry(include_threads, i);
|
230
|
-
VALUE thread_id = rb_obj_id(thread);
|
231
|
-
st_insert(profile->include_threads_tbl, thread_id, Qtrue);
|
232
|
-
}
|
233
|
-
}
|
234
|
-
|
235
|
-
return self;
|
236
|
-
}</pre>
|
237
|
-
</div>
|
238
|
-
|
239
|
-
</div>
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
</div>
|
245
|
-
|
246
|
-
|
247
|
-
<div id="method-c-profile" class="method-detail ">
|
248
|
-
|
249
|
-
|
250
|
-
<div class="method-heading">
|
251
|
-
<span class="method-callseq">
|
252
|
-
profile(&block) → self
|
253
|
-
</span>
|
254
|
-
|
255
|
-
<span class="method-click-advice">click to toggle source</span>
|
256
|
-
|
257
|
-
</div>
|
258
|
-
|
259
|
-
<div class="method-heading">
|
260
|
-
<span class="method-callseq">
|
261
|
-
profile(options, &block) → self
|
262
|
-
</span>
|
263
|
-
|
264
|
-
</div>
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
<div class="method-description">
|
269
|
-
|
270
|
-
<p>Profiles the specified block and returns a <a
|
271
|
-
href="Profile.html">RubyProf::Profile</a> object. Arguments are passed to
|
272
|
-
<a href="Profile.html">Profile</a> initialize method.</p>
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
<div class="method-source-code" id="profile-source">
|
278
|
-
<pre>static VALUE
|
279
|
-
prof_profile(int argc, VALUE *argv, VALUE klass)
|
280
|
-
{
|
281
|
-
int result;
|
282
|
-
VALUE profile = rb_class_new_instance(argc, argv, cProfile);
|
283
|
-
|
284
|
-
if (!rb_block_given_p())
|
285
|
-
{
|
286
|
-
rb_raise(rb_eArgError, "A block must be provided to the profile method.");
|
287
|
-
}
|
288
|
-
|
289
|
-
prof_start(profile);
|
290
|
-
rb_protect(rb_yield, profile, &result);
|
291
|
-
return prof_stop(profile);
|
292
|
-
}</pre>
|
293
|
-
</div>
|
294
|
-
|
295
|
-
</div>
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
</div>
|
301
|
-
|
302
|
-
|
303
|
-
</section>
|
304
|
-
|
305
|
-
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
306
|
-
<header>
|
307
|
-
<h3>Public Instance Methods</h3>
|
308
|
-
</header>
|
309
|
-
|
310
|
-
|
311
|
-
<div id="method-i-eliminate_methods-21" class="method-detail ">
|
312
|
-
|
313
|
-
<div class="method-heading">
|
314
|
-
<span class="method-name">eliminate_methods!</span><span
|
315
|
-
class="method-args">(matchers)</span>
|
316
|
-
|
317
|
-
<span class="method-click-advice">click to toggle source</span>
|
318
|
-
|
319
|
-
</div>
|
320
|
-
|
321
|
-
|
322
|
-
<div class="method-description">
|
323
|
-
|
324
|
-
<p>eliminate some calls from the graph by merging the information into
|
325
|
-
callers. matchers can be a list of strings or regular expressions or the
|
326
|
-
name of a file containing regexps.</p>
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
<div class="method-source-code" id="eliminate_methods-21-source">
|
332
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/profile.rb, line 15</span>
|
333
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">eliminate_methods!</span>(<span class="ruby-identifier">matchers</span>)
|
334
|
-
<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>)
|
335
|
-
<span class="ruby-identifier">eliminated</span> = []
|
336
|
-
<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>
|
337
|
-
<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>)) }
|
338
|
-
<span class="ruby-keyword">end</span>
|
339
|
-
<span class="ruby-identifier">eliminated</span>
|
340
|
-
<span class="ruby-keyword">end</span></pre>
|
341
|
-
</div>
|
342
|
-
|
343
|
-
</div>
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
</div>
|
349
|
-
|
350
|
-
|
351
|
-
<div id="method-i-pause" class="method-detail ">
|
352
|
-
|
353
|
-
|
354
|
-
<div class="method-heading">
|
355
|
-
<span class="method-callseq">
|
356
|
-
pause → self
|
357
|
-
</span>
|
358
|
-
|
359
|
-
<span class="method-click-advice">click to toggle source</span>
|
360
|
-
|
361
|
-
</div>
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
<div class="method-description">
|
366
|
-
|
367
|
-
<p>Pauses collecting profile data.</p>
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
<div class="method-source-code" id="pause-source">
|
373
|
-
<pre>static VALUE
|
374
|
-
prof_pause(VALUE self)
|
375
|
-
{
|
376
|
-
prof_profile_t* profile = prof_get_profile(self);
|
377
|
-
if (profile->running == Qfalse)
|
378
|
-
{
|
379
|
-
rb_raise(rb_eRuntimeError, "RubyProf is not running.");
|
380
|
-
}
|
381
|
-
|
382
|
-
if (profile->paused == Qfalse)
|
383
|
-
{
|
384
|
-
profile->paused = Qtrue;
|
385
|
-
profile->measurement_at_pause_resume = profile->measurer->measure();
|
386
|
-
st_foreach(profile->threads_tbl, pause_thread, (st_data_t) profile);
|
387
|
-
}
|
388
|
-
|
389
|
-
return self;
|
390
|
-
}</pre>
|
391
|
-
</div>
|
392
|
-
|
393
|
-
</div>
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
</div>
|
399
|
-
|
400
|
-
|
401
|
-
<div id="method-i-paused-3F" class="method-detail ">
|
402
|
-
|
403
|
-
|
404
|
-
<div class="method-heading">
|
405
|
-
<span class="method-callseq">
|
406
|
-
paused? → boolean
|
407
|
-
</span>
|
408
|
-
|
409
|
-
<span class="method-click-advice">click to toggle source</span>
|
410
|
-
|
411
|
-
</div>
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
<div class="method-description">
|
416
|
-
|
417
|
-
<p>Returns whether a profile is currently paused.</p>
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
<div class="method-source-code" id="paused-3F-source">
|
423
|
-
<pre>static VALUE
|
424
|
-
prof_paused(VALUE self)
|
425
|
-
{
|
426
|
-
prof_profile_t* profile = prof_get_profile(self);
|
427
|
-
return profile->paused;
|
428
|
-
}</pre>
|
429
|
-
</div>
|
430
|
-
|
431
|
-
</div>
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
</div>
|
437
|
-
|
438
|
-
|
439
|
-
<div id="method-i-post_process" class="method-detail ">
|
440
|
-
|
441
|
-
<div class="method-heading">
|
442
|
-
<span class="method-name">post_process</span><span
|
443
|
-
class="method-args">()</span>
|
444
|
-
|
445
|
-
<span class="method-click-advice">click to toggle source</span>
|
446
|
-
|
447
|
-
</div>
|
448
|
-
|
449
|
-
|
450
|
-
<div class="method-description">
|
451
|
-
|
452
|
-
<p>This method gets called once profiling has been completed but before
|
453
|
-
results are returned to the user. Thus it provides a hook to do any
|
454
|
-
necessary post-processing on the call graph.</p>
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
<div class="method-source-code" id="post_process-source">
|
460
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/profile.rb, line 7</span>
|
461
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">post_process</span>
|
462
|
-
<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>
|
463
|
-
<span class="ruby-identifier">thread</span>.<span class="ruby-identifier">detect_recursion</span>
|
464
|
-
<span class="ruby-keyword">end</span>
|
465
|
-
<span class="ruby-keyword">end</span></pre>
|
466
|
-
</div>
|
467
|
-
|
468
|
-
</div>
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
</div>
|
474
|
-
|
475
|
-
|
476
|
-
<div id="method-i-resume" class="method-detail ">
|
477
|
-
|
478
|
-
|
479
|
-
<div class="method-heading">
|
480
|
-
<span class="method-callseq">
|
481
|
-
resume → self
|
482
|
-
</span>
|
483
|
-
|
484
|
-
<span class="method-click-advice">click to toggle source</span>
|
485
|
-
|
486
|
-
</div>
|
487
|
-
|
488
|
-
<div class="method-heading">
|
489
|
-
<span class="method-callseq">
|
490
|
-
resume(&block) → self
|
491
|
-
</span>
|
492
|
-
|
493
|
-
</div>
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
<div class="method-description">
|
498
|
-
|
499
|
-
<p>Resumes recording profile data.</p>
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
<div class="method-source-code" id="resume-source">
|
505
|
-
<pre>static VALUE
|
506
|
-
prof_resume(VALUE self)
|
507
|
-
{
|
508
|
-
prof_profile_t* profile = prof_get_profile(self);
|
509
|
-
if (profile->running == Qfalse)
|
510
|
-
{
|
511
|
-
rb_raise(rb_eRuntimeError, "RubyProf is not running.");
|
512
|
-
}
|
513
|
-
|
514
|
-
if (profile->paused == Qtrue)
|
515
|
-
{
|
516
|
-
profile->paused = Qfalse;
|
517
|
-
profile->measurement_at_pause_resume = profile->measurer->measure();
|
518
|
-
st_foreach(profile->threads_tbl, unpause_thread, (st_data_t) profile);
|
519
|
-
}
|
520
|
-
|
521
|
-
return rb_block_given_p() ? rb_ensure(rb_yield, self, prof_pause, self) : self;
|
522
|
-
}</pre>
|
523
|
-
</div>
|
524
|
-
|
525
|
-
</div>
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
</div>
|
531
|
-
|
532
|
-
|
533
|
-
<div id="method-i-running-3F" class="method-detail ">
|
534
|
-
|
535
|
-
|
536
|
-
<div class="method-heading">
|
537
|
-
<span class="method-callseq">
|
538
|
-
running? → boolean
|
539
|
-
</span>
|
540
|
-
|
541
|
-
<span class="method-click-advice">click to toggle source</span>
|
542
|
-
|
543
|
-
</div>
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
<div class="method-description">
|
548
|
-
|
549
|
-
<p>Returns whether a profile is currently running.</p>
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
<div class="method-source-code" id="running-3F-source">
|
555
|
-
<pre>static VALUE
|
556
|
-
prof_running(VALUE self)
|
557
|
-
{
|
558
|
-
prof_profile_t* profile = prof_get_profile(self);
|
559
|
-
return profile->running;
|
560
|
-
}</pre>
|
561
|
-
</div>
|
562
|
-
|
563
|
-
</div>
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
</div>
|
569
|
-
|
570
|
-
|
571
|
-
<div id="method-i-start" class="method-detail ">
|
572
|
-
|
573
|
-
|
574
|
-
<div class="method-heading">
|
575
|
-
<span class="method-callseq">
|
576
|
-
start → self
|
577
|
-
</span>
|
578
|
-
|
579
|
-
<span class="method-click-advice">click to toggle source</span>
|
580
|
-
|
581
|
-
</div>
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
<div class="method-description">
|
586
|
-
|
587
|
-
<p>Starts recording profile data.</p>
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
<div class="method-source-code" id="start-source">
|
593
|
-
<pre>static VALUE
|
594
|
-
prof_start(VALUE self)
|
595
|
-
{
|
596
|
-
char* trace_file_name;
|
597
|
-
|
598
|
-
prof_profile_t* profile = prof_get_profile(self);
|
599
|
-
|
600
|
-
if (profile->running == Qtrue)
|
601
|
-
{
|
602
|
-
rb_raise(rb_eRuntimeError, "RubyProf.start was already called");
|
603
|
-
}
|
604
|
-
|
605
|
-
profile->running = Qtrue;
|
606
|
-
profile->paused = Qfalse;
|
607
|
-
profile->last_thread_data = NULL;
|
608
|
-
|
609
|
-
|
610
|
-
/* open trace file if environment wants it */
|
611
|
-
trace_file_name = getenv("RUBY_PROF_TRACE");
|
612
|
-
if (trace_file_name != NULL)
|
613
|
-
{
|
614
|
-
if (strcmp(trace_file_name, "stdout") == 0)
|
615
|
-
{
|
616
|
-
trace_file = stdout;
|
617
|
-
}
|
618
|
-
else if (strcmp(trace_file_name, "stderr") == 0)
|
619
|
-
{
|
620
|
-
trace_file = stderr;
|
621
|
-
}
|
622
|
-
else
|
623
|
-
{
|
624
|
-
trace_file = fopen(trace_file_name, "w");
|
625
|
-
}
|
626
|
-
}
|
627
|
-
|
628
|
-
prof_install_hook(self);
|
629
|
-
return self;
|
630
|
-
}</pre>
|
631
|
-
</div>
|
632
|
-
|
633
|
-
</div>
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
</div>
|
639
|
-
|
640
|
-
|
641
|
-
<div id="method-i-stop" class="method-detail ">
|
642
|
-
|
643
|
-
|
644
|
-
<div class="method-heading">
|
645
|
-
<span class="method-callseq">
|
646
|
-
stop → self
|
647
|
-
</span>
|
648
|
-
|
649
|
-
<span class="method-click-advice">click to toggle source</span>
|
650
|
-
|
651
|
-
</div>
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
<div class="method-description">
|
656
|
-
|
657
|
-
<p>Stops collecting profile data.</p>
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
<div class="method-source-code" id="stop-source">
|
663
|
-
<pre>static VALUE
|
664
|
-
prof_stop(VALUE self)
|
665
|
-
{
|
666
|
-
prof_profile_t* profile = prof_get_profile(self);
|
667
|
-
|
668
|
-
if (profile->running == Qfalse)
|
669
|
-
{
|
670
|
-
rb_raise(rb_eRuntimeError, "RubyProf.start was not yet called");
|
671
|
-
}
|
672
|
-
|
673
|
-
prof_remove_hook();
|
674
|
-
|
675
|
-
/* close trace file if open */
|
676
|
-
if (trace_file != NULL)
|
677
|
-
{
|
678
|
-
if (trace_file !=stderr && trace_file != stdout)
|
679
|
-
{
|
680
|
-
#ifdef _MSC_VER
|
681
|
-
_fcloseall();
|
682
|
-
#else
|
683
|
-
fclose(trace_file);
|
684
|
-
#endif
|
685
|
-
}
|
686
|
-
trace_file = NULL;
|
687
|
-
}
|
688
|
-
|
689
|
-
prof_pop_threads(profile);
|
690
|
-
|
691
|
-
/* Unset the last_thread_data (very important!)
|
692
|
-
and the threads table */
|
693
|
-
profile->running = profile->paused = Qfalse;
|
694
|
-
profile->last_thread_data = NULL;
|
695
|
-
|
696
|
-
/* Post process result */
|
697
|
-
rb_funcall(self, rb_intern("post_process") , 0);
|
698
|
-
|
699
|
-
return self;
|
700
|
-
}</pre>
|
701
|
-
</div>
|
702
|
-
|
703
|
-
</div>
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
</div>
|
709
|
-
|
710
|
-
|
711
|
-
<div id="method-i-threads" class="method-detail ">
|
712
|
-
|
713
|
-
|
714
|
-
<div class="method-heading">
|
715
|
-
<span class="method-callseq">
|
716
|
-
threads → array of RubyProf::Thread
|
717
|
-
</span>
|
718
|
-
|
719
|
-
<span class="method-click-advice">click to toggle source</span>
|
720
|
-
|
721
|
-
</div>
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
<div class="method-description">
|
726
|
-
|
727
|
-
<p>Returns an array of <a href="Thread.html">RubyProf::Thread</a> instances
|
728
|
-
that were executed while the the program was being run.</p>
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
<div class="method-source-code" id="threads-source">
|
734
|
-
<pre>static VALUE
|
735
|
-
prof_threads(VALUE self)
|
736
|
-
{
|
737
|
-
VALUE result = rb_ary_new();
|
738
|
-
prof_profile_t* profile = prof_get_profile(self);
|
739
|
-
st_foreach(profile->threads_tbl, collect_threads, result);
|
740
|
-
return result;
|
741
|
-
}</pre>
|
742
|
-
</div>
|
743
|
-
|
744
|
-
</div>
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
</div>
|
750
|
-
|
751
|
-
|
752
|
-
</section>
|
753
|
-
|
754
|
-
</section>
|
755
|
-
</main>
|
756
|
-
|
757
|
-
|
758
|
-
<footer id="validator-badges" role="contentinfo">
|
759
|
-
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
760
|
-
<p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.2.
|
761
|
-
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
762
|
-
</footer>
|
763
|
-
|