ruby-prof 0.15.9 → 0.16.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES +27 -1
- data/README.rdoc +83 -31
- data/bin/ruby-prof +4 -4
- data/doc/LICENSE.html +1 -1
- data/doc/README_rdoc.html +92 -33
- data/doc/Rack.html +1 -1
- data/doc/Rack/RubyProf.html +17 -14
- data/doc/RubyProf.html +30 -29
- data/doc/RubyProf/AbstractPrinter.html +1 -1
- data/doc/RubyProf/AggregateCallInfo.html +1 -1
- data/doc/RubyProf/CallInfo.html +1 -1
- data/doc/RubyProf/CallInfoPrinter.html +1 -1
- data/doc/RubyProf/CallInfoVisitor.html +1 -1
- data/doc/RubyProf/CallStackPrinter.html +1 -1
- data/doc/RubyProf/CallTreePrinter.html +349 -67
- data/doc/RubyProf/Cmd.html +5 -5
- data/doc/RubyProf/DotPrinter.html +2 -2
- data/doc/RubyProf/FlatPrinter.html +1 -1
- data/doc/RubyProf/FlatPrinterWithLineNumbers.html +1 -1
- data/doc/RubyProf/GraphHtmlPrinter.html +1 -1
- data/doc/RubyProf/GraphPrinter.html +1 -1
- data/doc/RubyProf/MethodInfo.html +2 -2
- data/doc/RubyProf/MultiPrinter.html +11 -9
- data/doc/RubyProf/Profile.html +94 -44
- data/doc/RubyProf/ProfileTask.html +1 -1
- data/doc/RubyProf/Thread.html +43 -1
- data/doc/created.rid +16 -16
- data/doc/examples/flat_txt.html +1 -1
- data/doc/examples/graph_html.html +1 -1
- data/doc/examples/graph_txt.html +3 -3
- data/doc/index.html +85 -30
- data/doc/js/navigation.js.gz +0 -0
- data/doc/js/search_index.js +1 -1
- data/doc/js/search_index.js.gz +0 -0
- data/doc/js/searcher.js +2 -2
- data/doc/js/searcher.js.gz +0 -0
- data/doc/table_of_contents.html +117 -68
- data/examples/cachegrind.out.1 +114 -0
- data/examples/cachegrind.out.1.32313213 +114 -0
- data/examples/graph.txt +1 -1
- data/ext/ruby_prof/extconf.rb +6 -2
- data/ext/ruby_prof/rp_measure_cpu_time.c +29 -31
- data/ext/ruby_prof/rp_method.c +1 -1
- data/ext/ruby_prof/rp_thread.c +57 -52
- data/ext/ruby_prof/ruby_prof.c +122 -66
- data/ext/ruby_prof/ruby_prof.h +2 -0
- data/lib/ruby-prof.rb +14 -13
- data/lib/ruby-prof/assets/call_stack_printer.js.html +1 -1
- data/lib/ruby-prof/compatibility.rb +9 -8
- data/lib/ruby-prof/method_info.rb +1 -1
- data/lib/ruby-prof/printers/call_tree_printer.rb +88 -50
- data/lib/ruby-prof/printers/dot_printer.rb +1 -1
- data/lib/ruby-prof/printers/multi_printer.rb +6 -4
- data/lib/ruby-prof/profile.rb +0 -1
- data/lib/ruby-prof/rack.rb +53 -16
- data/lib/ruby-prof/thread.rb +11 -0
- data/lib/ruby-prof/version.rb +1 -1
- data/test/exclude_threads_test.rb +2 -3
- data/test/fiber_test.rb +21 -7
- data/test/measure_cpu_time_test.rb +84 -24
- data/test/multi_printer_test.rb +5 -4
- data/test/pause_resume_test.rb +7 -7
- data/test/printers_test.rb +6 -4
- data/test/rack_test.rb +26 -1
- data/test/test_helper.rb +28 -3
- data/test/thread_test.rb +1 -0
- metadata +5 -3
data/doc/RubyProf/Cmd.html
CHANGED
@@ -331,8 +331,8 @@
|
|
331
331
|
<span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-string">'--mode=measure_mode'</span>,
|
332
332
|
[<span class="ruby-value">:process</span>, <span class="ruby-value">:wall</span>, <span class="ruby-value">:cpu</span>, <span class="ruby-value">:allocations</span>, <span class="ruby-value">:memory</span>, <span class="ruby-value">:gc_runs</span>, <span class="ruby-value">:gc_time</span>],
|
333
333
|
<span class="ruby-string">'Select what ruby-prof should measure:'</span>,
|
334
|
-
<span class="ruby-string">'
|
335
|
-
<span class="ruby-string">'
|
334
|
+
<span class="ruby-string">' wall - Wall time (default).'</span>,
|
335
|
+
<span class="ruby-string">' process - Process time.'</span>,
|
336
336
|
<span class="ruby-string">' cpu - CPU time (Pentium and PowerPCs only).'</span>,
|
337
337
|
<span class="ruby-string">' allocations - Object allocations (requires patched Ruby interpreter).'</span>,
|
338
338
|
<span class="ruby-string">' memory - Allocated memory in KB (requires patched Ruby interpreter).'</span>,
|
@@ -340,10 +340,10 @@
|
|
340
340
|
<span class="ruby-string">' gc_time - Time spent in garbage collection (requires patched Ruby interpreter).'</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">measure_mode</span><span class="ruby-operator">|</span>
|
341
341
|
|
342
342
|
<span class="ruby-keyword">case</span> <span class="ruby-identifier">measure_mode</span>
|
343
|
-
<span class="ruby-keyword">when</span> <span class="ruby-value">:process</span>
|
344
|
-
<span class="ruby-identifier">options</span>.<span class="ruby-identifier">measure_mode</span> = <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">PROCESS_TIME</span>
|
345
343
|
<span class="ruby-keyword">when</span> <span class="ruby-value">:wall</span>
|
346
344
|
<span class="ruby-identifier">options</span>.<span class="ruby-identifier">measure_mode</span> = <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">WALL_TIME</span>
|
345
|
+
<span class="ruby-keyword">when</span> <span class="ruby-value">:process</span>
|
346
|
+
<span class="ruby-identifier">options</span>.<span class="ruby-identifier">measure_mode</span> = <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">PROCESS_TIME</span>
|
347
347
|
<span class="ruby-keyword">when</span> <span class="ruby-value">:cpu</span>
|
348
348
|
<span class="ruby-identifier">options</span>.<span class="ruby-identifier">measure_mode</span> = <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">CPU_TIME</span>
|
349
349
|
<span class="ruby-keyword">when</span> <span class="ruby-value">:allocations</span>
|
@@ -625,7 +625,7 @@
|
|
625
625
|
|
626
626
|
<footer id="validator-badges" role="contentinfo">
|
627
627
|
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
628
|
-
<p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.
|
628
|
+
<p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.2.
|
629
629
|
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
630
630
|
</footer>
|
631
631
|
|
@@ -155,7 +155,7 @@ tool to reformat the output into a wide variety of outputs:</p>
|
|
155
155
|
<div class="method-description">
|
156
156
|
|
157
157
|
<p>Creates the <a href="DotPrinter.html">DotPrinter</a> using a
|
158
|
-
RubyProf::
|
158
|
+
RubyProf::Proile.</p>
|
159
159
|
|
160
160
|
|
161
161
|
<div class="method-calls-super">
|
@@ -251,7 +251,7 @@ to use the :min_percent option, for example:</p>
|
|
251
251
|
|
252
252
|
<footer id="validator-badges" role="contentinfo">
|
253
253
|
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
254
|
-
<p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.
|
254
|
+
<p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.2.
|
255
255
|
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
256
256
|
</footer>
|
257
257
|
|
@@ -157,7 +157,7 @@ printer.print(STDOUT, {})</pre>
|
|
157
157
|
|
158
158
|
<footer id="validator-badges" role="contentinfo">
|
159
159
|
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
160
|
-
<p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.
|
160
|
+
<p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.2.
|
161
161
|
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
162
162
|
</footer>
|
163
163
|
|
@@ -202,7 +202,7 @@ printer.print(STDOUT, {})</pre>
|
|
202
202
|
|
203
203
|
<footer id="validator-badges" role="contentinfo">
|
204
204
|
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
205
|
-
<p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.
|
205
|
+
<p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.2.
|
206
206
|
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
207
207
|
</footer>
|
208
208
|
|
@@ -546,7 +546,7 @@ be printed out.</p>
|
|
546
546
|
|
547
547
|
<footer id="validator-badges" role="contentinfo">
|
548
548
|
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
549
|
-
<p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.
|
549
|
+
<p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.2.
|
550
550
|
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
551
551
|
</footer>
|
552
552
|
|
@@ -133,7 +133,7 @@ href="../README_rdoc.html">README</a></p>
|
|
133
133
|
|
134
134
|
<footer id="validator-badges" role="contentinfo">
|
135
135
|
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
136
|
-
<p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.
|
136
|
+
<p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.2.
|
137
137
|
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
138
138
|
</footer>
|
139
139
|
|
@@ -643,7 +643,7 @@
|
|
643
643
|
<div class="method-source-code" id="to_s-source">
|
644
644
|
<pre><span class="ruby-comment"># File lib/ruby-prof/method_info.rb, line 116</span>
|
645
645
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">to_s</span>
|
646
|
-
<span class="ruby-node">"#{self.full_name} (c: #{self.called}, tt: #{self.total_time}, st: #{self.self_time}, ct: #{self.children_time})"</span>
|
646
|
+
<span class="ruby-node">"#{self.full_name} (c: #{self.called}, tt: #{self.total_time}, st: #{self.self_time}, wt: #{wait_time}, ct: #{self.children_time})"</span>
|
647
647
|
<span class="ruby-keyword">end</span></pre>
|
648
648
|
</div>
|
649
649
|
|
@@ -739,7 +739,7 @@
|
|
739
739
|
|
740
740
|
<footer id="validator-badges" role="contentinfo">
|
741
741
|
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
742
|
-
<p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.
|
742
|
+
<p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.2.
|
743
743
|
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
744
744
|
</footer>
|
745
745
|
|
@@ -183,7 +183,7 @@ stack profile and a graph profile.</p>
|
|
183
183
|
|
184
184
|
|
185
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
|
186
|
+
<pre><span class="ruby-comment"># File lib/ruby-prof/printers/multi_printer.rb, line 52</span>
|
187
187
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">flat_profile</span>
|
188
188
|
<span class="ruby-node">"#{@directory}/#{@profile}.flat.txt"</span>
|
189
189
|
<span class="ruby-keyword">end</span></pre>
|
@@ -216,7 +216,7 @@ stack profile and a graph profile.</p>
|
|
216
216
|
|
217
217
|
|
218
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
|
219
|
+
<pre><span class="ruby-comment"># File lib/ruby-prof/printers/multi_printer.rb, line 42</span>
|
220
220
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">graph_profile</span>
|
221
221
|
<span class="ruby-node">"#{@directory}/#{@profile}.graph.html"</span>
|
222
222
|
<span class="ruby-keyword">end</span></pre>
|
@@ -255,15 +255,17 @@ pofile file, defaults to “profile”.</p>
|
|
255
255
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">print</span>(<span class="ruby-identifier">options</span>)
|
256
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
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
|
+
|
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>
|
259
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>))
|
260
261
|
<span class="ruby-keyword">end</span>
|
262
|
+
|
261
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>
|
262
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>)
|
263
265
|
<span class="ruby-keyword">end</span>
|
264
|
-
|
265
|
-
|
266
|
-
|
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
|
+
|
267
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>
|
268
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>)
|
269
271
|
<span class="ruby-keyword">end</span>
|
@@ -297,7 +299,7 @@ pofile file, defaults to “profile”.</p>
|
|
297
299
|
|
298
300
|
|
299
301
|
<div class="method-source-code" id="stack_profile-source">
|
300
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/printers/multi_printer.rb, line
|
302
|
+
<pre><span class="ruby-comment"># File lib/ruby-prof/printers/multi_printer.rb, line 37</span>
|
301
303
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">stack_profile</span>
|
302
304
|
<span class="ruby-node">"#{@directory}/#{@profile}.stack.html"</span>
|
303
305
|
<span class="ruby-keyword">end</span></pre>
|
@@ -330,9 +332,9 @@ pofile file, defaults to “profile”.</p>
|
|
330
332
|
|
331
333
|
|
332
334
|
<div class="method-source-code" id="tree_profile-source">
|
333
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/printers/multi_printer.rb, line
|
335
|
+
<pre><span class="ruby-comment"># File lib/ruby-prof/printers/multi_printer.rb, line 47</span>
|
334
336
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">tree_profile</span>
|
335
|
-
<span class="ruby-node">"#{@directory}/#{@profile}.
|
337
|
+
<span class="ruby-node">"#{@directory}/#{@profile}.callgrind.out.#{$$}"</span>
|
336
338
|
<span class="ruby-keyword">end</span></pre>
|
337
339
|
</div>
|
338
340
|
|
@@ -352,7 +354,7 @@ pofile file, defaults to “profile”.</p>
|
|
352
354
|
|
353
355
|
<footer id="validator-badges" role="contentinfo">
|
354
356
|
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
355
|
-
<p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.
|
357
|
+
<p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.2.
|
356
358
|
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
357
359
|
</footer>
|
358
360
|
|
data/doc/RubyProf/Profile.html
CHANGED
@@ -131,27 +131,40 @@
|
|
131
131
|
|
132
132
|
<div class="method-heading">
|
133
133
|
<span class="method-callseq">
|
134
|
-
|
134
|
+
new()
|
135
135
|
</span>
|
136
136
|
|
137
137
|
<span class="method-click-advice">click to toggle source</span>
|
138
138
|
|
139
139
|
</div>
|
140
140
|
|
141
|
+
<div class="method-heading">
|
142
|
+
<span class="method-callseq">
|
143
|
+
new(options)
|
144
|
+
</span>
|
145
|
+
|
146
|
+
</div>
|
147
|
+
|
141
148
|
|
142
149
|
|
143
150
|
<div class="method-description">
|
144
151
|
|
145
|
-
<p>Returns a new profiler
|
146
|
-
|
147
|
-
<h2 id="method-c-new-label-Parameters">Parameters<span><a href="#method-c-new-label-Parameters">¶</a> <a href="#top">↑</a></span></h2>
|
148
|
-
<dl class="rdoc-list note-list"><dt>mode
|
152
|
+
<p>Returns a new profiler. Possible options for the options hash are:</p>
|
153
|
+
<dl class="rdoc-list note-list"><dt>measure_mode
|
149
154
|
<dd>
|
150
|
-
<p>Measure mode
|
151
|
-
|
155
|
+
<p>Measure mode. Specifies the profile measure mode. If not specified,
|
156
|
+
defaults to RubyProf::WALL_TIME.</p>
|
152
157
|
</dd><dt>exclude_threads
|
153
158
|
<dd>
|
154
|
-
<p>Threads to exclude from the profiling results
|
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>
|
155
168
|
</dd></dl>
|
156
169
|
|
157
170
|
|
@@ -162,40 +175,61 @@ specified, defaults to RubyProf::WALL_TIME.</p>
|
|
162
175
|
prof_initialize(int argc, VALUE *argv, VALUE self)
|
163
176
|
{
|
164
177
|
prof_profile_t* profile = prof_get_profile(self);
|
165
|
-
VALUE
|
166
|
-
|
167
|
-
VALUE exclude_threads;
|
178
|
+
VALUE mode_or_options;
|
179
|
+
VALUE mode = Qnil;
|
180
|
+
VALUE exclude_threads = Qnil;
|
181
|
+
VALUE include_threads = Qnil;
|
182
|
+
VALUE merge_fibers = Qnil;
|
168
183
|
int i;
|
169
|
-
|
170
|
-
switch (rb_scan_args(argc, argv, "02", &
|
171
|
-
|
172
|
-
case 0:
|
173
|
-
{
|
174
|
-
measurer = MEASURE_WALL_TIME;
|
175
|
-
exclude_threads = rb_ary_new();
|
184
|
+
|
185
|
+
switch (rb_scan_args(argc, argv, "02", &mode_or_options, &exclude_threads)) {
|
186
|
+
case 0:
|
176
187
|
break;
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
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
|
+
}
|
182
199
|
break;
|
183
|
-
|
184
|
-
case 2:
|
185
|
-
{
|
200
|
+
case 2:
|
186
201
|
Check_Type(exclude_threads, T_ARRAY);
|
187
|
-
measurer = (prof_measure_mode_t)NUM2INT(mode);
|
188
202
|
break;
|
189
|
-
}
|
190
203
|
}
|
191
204
|
|
192
|
-
|
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;
|
193
212
|
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
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
|
+
}
|
199
233
|
}
|
200
234
|
|
201
235
|
return self;
|
@@ -215,18 +249,27 @@ prof_initialize(int argc, VALUE *argv, VALUE self)
|
|
215
249
|
|
216
250
|
<div class="method-heading">
|
217
251
|
<span class="method-callseq">
|
218
|
-
profile
|
252
|
+
profile(&block) → self
|
219
253
|
</span>
|
220
254
|
|
221
255
|
<span class="method-click-advice">click to toggle source</span>
|
222
256
|
|
223
257
|
</div>
|
224
258
|
|
259
|
+
<div class="method-heading">
|
260
|
+
<span class="method-callseq">
|
261
|
+
profile(options, &block) → self
|
262
|
+
</span>
|
263
|
+
|
264
|
+
</div>
|
265
|
+
|
225
266
|
|
226
267
|
|
227
268
|
<div class="method-description">
|
228
269
|
|
229
|
-
<p>Profiles the specified block and returns a
|
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>
|
230
273
|
|
231
274
|
|
232
275
|
|
@@ -286,7 +329,7 @@ name of a file containing regexps.</p>
|
|
286
329
|
|
287
330
|
|
288
331
|
<div class="method-source-code" id="eliminate_methods-21-source">
|
289
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/profile.rb, line
|
332
|
+
<pre><span class="ruby-comment"># File lib/ruby-prof/profile.rb, line 15</span>
|
290
333
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">eliminate_methods!</span>(<span class="ruby-identifier">matchers</span>)
|
291
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>)
|
292
335
|
<span class="ruby-identifier">eliminated</span> = []
|
@@ -310,7 +353,7 @@ name of a file containing regexps.</p>
|
|
310
353
|
|
311
354
|
<div class="method-heading">
|
312
355
|
<span class="method-callseq">
|
313
|
-
pause →
|
356
|
+
pause → self
|
314
357
|
</span>
|
315
358
|
|
316
359
|
<span class="method-click-advice">click to toggle source</span>
|
@@ -414,7 +457,7 @@ necessary post-processing on the call graph.</p>
|
|
414
457
|
|
415
458
|
|
416
459
|
<div class="method-source-code" id="post_process-source">
|
417
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/profile.rb, line
|
460
|
+
<pre><span class="ruby-comment"># File lib/ruby-prof/profile.rb, line 7</span>
|
418
461
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">post_process</span>
|
419
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>
|
420
463
|
<span class="ruby-identifier">thread</span>.<span class="ruby-identifier">detect_recursion</span>
|
@@ -435,13 +478,20 @@ necessary post-processing on the call graph.</p>
|
|
435
478
|
|
436
479
|
<div class="method-heading">
|
437
480
|
<span class="method-callseq">
|
438
|
-
resume
|
481
|
+
resume → self
|
439
482
|
</span>
|
440
483
|
|
441
484
|
<span class="method-click-advice">click to toggle source</span>
|
442
485
|
|
443
486
|
</div>
|
444
487
|
|
488
|
+
<div class="method-heading">
|
489
|
+
<span class="method-callseq">
|
490
|
+
resume(&block) → self
|
491
|
+
</span>
|
492
|
+
|
493
|
+
</div>
|
494
|
+
|
445
495
|
|
446
496
|
|
447
497
|
<div class="method-description">
|
@@ -523,7 +573,7 @@ prof_running(VALUE self)
|
|
523
573
|
|
524
574
|
<div class="method-heading">
|
525
575
|
<span class="method-callseq">
|
526
|
-
start →
|
576
|
+
start → self
|
527
577
|
</span>
|
528
578
|
|
529
579
|
<span class="method-click-advice">click to toggle source</span>
|
@@ -663,7 +713,7 @@ prof_stop(VALUE self)
|
|
663
713
|
|
664
714
|
<div class="method-heading">
|
665
715
|
<span class="method-callseq">
|
666
|
-
threads →
|
716
|
+
threads → array of RubyProf::Thread
|
667
717
|
</span>
|
668
718
|
|
669
719
|
<span class="method-click-advice">click to toggle source</span>
|
@@ -684,7 +734,7 @@ that were executed while the the program was being run.</p>
|
|
684
734
|
<pre>static VALUE
|
685
735
|
prof_threads(VALUE self)
|
686
736
|
{
|
687
|
-
|
737
|
+
VALUE result = rb_ary_new();
|
688
738
|
prof_profile_t* profile = prof_get_profile(self);
|
689
739
|
st_foreach(profile->threads_tbl, collect_threads, result);
|
690
740
|
return result;
|
@@ -707,7 +757,7 @@ prof_threads(VALUE self)
|
|
707
757
|
|
708
758
|
<footer id="validator-badges" role="contentinfo">
|
709
759
|
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
710
|
-
<p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.
|
760
|
+
<p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.2.
|
711
761
|
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
712
762
|
</footer>
|
713
763
|
|
@@ -484,7 +484,7 @@ allows Test::Unit options to be passed to the test suite.</p>
|
|
484
484
|
|
485
485
|
<footer id="validator-badges" role="contentinfo">
|
486
486
|
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
487
|
-
<p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.
|
487
|
+
<p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.2.
|
488
488
|
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
489
489
|
</footer>
|
490
490
|
|
data/doc/RubyProf/Thread.html
CHANGED
@@ -78,6 +78,8 @@
|
|
78
78
|
|
79
79
|
<li ><a href="#method-i-total_time">#total_time</a>
|
80
80
|
|
81
|
+
<li ><a href="#method-i-wait_time">#wait_time</a>
|
82
|
+
|
81
83
|
</ul>
|
82
84
|
</div>
|
83
85
|
|
@@ -251,6 +253,46 @@ should be called only once for each thread</p>
|
|
251
253
|
|
252
254
|
|
253
255
|
|
256
|
+
</div>
|
257
|
+
|
258
|
+
|
259
|
+
<div id="method-i-wait_time" class="method-detail ">
|
260
|
+
|
261
|
+
<div class="method-heading">
|
262
|
+
<span class="method-name">wait_time</span><span
|
263
|
+
class="method-args">()</span>
|
264
|
+
|
265
|
+
<span class="method-click-advice">click to toggle source</span>
|
266
|
+
|
267
|
+
</div>
|
268
|
+
|
269
|
+
|
270
|
+
<div class="method-description">
|
271
|
+
|
272
|
+
|
273
|
+
|
274
|
+
|
275
|
+
|
276
|
+
|
277
|
+
<div class="method-source-code" id="wait_time-source">
|
278
|
+
<pre><span class="ruby-comment"># File lib/ruby-prof/thread.rb, line 30</span>
|
279
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">wait_time</span>
|
280
|
+
<span class="ruby-comment"># wait_time, like self:time, is always method local</span>
|
281
|
+
<span class="ruby-comment"># thus we need to sum over all methods and call infos</span>
|
282
|
+
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">methods</span>.<span class="ruby-identifier">inject</span>(<span class="ruby-value">0</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">sum</span>, <span class="ruby-identifier">method_info</span><span class="ruby-operator">|</span>
|
283
|
+
<span class="ruby-identifier">method_info</span>.<span class="ruby-identifier">call_infos</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">call_info</span><span class="ruby-operator">|</span>
|
284
|
+
<span class="ruby-identifier">sum</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">call_info</span>.<span class="ruby-identifier">wait_time</span>
|
285
|
+
<span class="ruby-keyword">end</span>
|
286
|
+
<span class="ruby-identifier">sum</span>
|
287
|
+
<span class="ruby-keyword">end</span>
|
288
|
+
<span class="ruby-keyword">end</span></pre>
|
289
|
+
</div>
|
290
|
+
|
291
|
+
</div>
|
292
|
+
|
293
|
+
|
294
|
+
|
295
|
+
|
254
296
|
</div>
|
255
297
|
|
256
298
|
|
@@ -262,7 +304,7 @@ should be called only once for each thread</p>
|
|
262
304
|
|
263
305
|
<footer id="validator-badges" role="contentinfo">
|
264
306
|
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
265
|
-
<p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.
|
307
|
+
<p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.2.
|
266
308
|
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
267
309
|
</footer>
|
268
310
|
|