ruby-prof 0.13.0 → 0.13.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.rdoc +8 -7
- data/doc/LICENSE.html +5 -5
- data/doc/README_rdoc.html +58 -50
- data/doc/Rack/RubyProf.html +6 -6
- data/doc/RubyProf.html +5 -4
- data/doc/RubyProf/AbstractPrinter.html +1 -1
- data/doc/RubyProf/CallInfo.html +2 -2
- data/doc/RubyProf/CallInfoPrinter.html +1 -1
- data/doc/RubyProf/CallStackPrinter.html +39 -39
- data/doc/RubyProf/CallTreePrinter.html +8 -8
- data/doc/RubyProf/Cmd.html +38 -38
- data/doc/RubyProf/DotPrinter.html +2 -2
- data/doc/RubyProf/FlatPrinterWithLineNumbers.html +3 -3
- data/doc/RubyProf/GraphHtmlPrinter.html +10 -11
- data/doc/RubyProf/MethodInfo.html +2 -2
- data/doc/RubyProf/ProfileTask.html +7 -7
- data/doc/RubyProf/Test.html +11 -11
- data/doc/created.rid +4 -4
- data/doc/examples/flat_txt.html +1 -1
- data/doc/examples/graph_txt.html +3 -3
- data/doc/index.html +58 -50
- data/doc/js/search_index.js +1 -1
- data/ext/ruby_prof/extconf.rb +1 -1
- data/ext/ruby_prof/version.h +2 -2
- data/lib/ruby-prof/printers/graph_html_printer.rb +3 -4
- data/ruby-prof.gemspec +2 -2
- data/test/multi_printer_test.rb +2 -1
- data/test/stack_printer_test.rb +4 -2
- metadata +20 -37
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4981adb0602037a3dbf06674dc2df341ff80fce9
|
4
|
+
data.tar.gz: b6ba1051e11bd2e193bb99cd786bc16681ea159a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5c8db375d6009b0da09e60a890bc605f5d289ca8e868cebd01910b3b8c788bf140dda2473a149578bf540ab863b355905c9b87386dbc2b05f707609a031efece
|
7
|
+
data.tar.gz: 22c4d62dda4759db6d4c29581b3ab5634da90cae709715229ce30a0c57ef00a73ec7b44f9f5006a0999c7679f8595a597e441b76ad4750c66a986621c4dc6c0f
|
data/README.rdoc
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
= ruby-prof
|
2
|
+
{<img src="https://travis-ci.org/ruby-prof/ruby-prof.png?branch=master" alt="Build Status" />}[https://travis-ci.org/ruby-prof/ruby-prof]
|
2
3
|
|
3
4
|
== Overview
|
4
5
|
|
@@ -224,7 +225,7 @@ ruby-prof can generate a number of different reports:
|
|
224
225
|
Flat profiles show the overall time spent in each method. They
|
225
226
|
are a good of quickly identifying which methods take the most time.
|
226
227
|
An example of a flat profile and an explanation can be found in
|
227
|
-
{examples/flat.txt}[http://github.com/
|
228
|
+
{examples/flat.txt}[http://github.com/ruby-prof/ruby-prof/tree/master/examples/flat.txt].
|
228
229
|
|
229
230
|
There are several varieties of these -- run $ ruby-prof --help
|
230
231
|
|
@@ -233,13 +234,13 @@ addition, they also show which methods call the current method and which
|
|
233
234
|
methods its calls. Thus they are good for understanding how methods
|
234
235
|
gets called and provide insight into the flow of your program. An
|
235
236
|
example text graph profile is located at
|
236
|
-
{examples/graph.txt}[http://github.com/
|
237
|
+
{examples/graph.txt}[http://github.com/ruby-prof/ruby-prof/tree/master/examples/graph.txt].
|
237
238
|
|
238
239
|
HTML Graph profiles are the same as graph profiles, except output is
|
239
240
|
generated in hyper-linked HTML. Since graph profiles can be quite large,
|
240
241
|
the embedded links make it much easier to navigate the results. An
|
241
242
|
example html graph profile is located at
|
242
|
-
{examples/graph.html}[http://github.com/
|
243
|
+
{examples/graph.html}[http://github.com/ruby-prof/ruby-prof/tree/master/examples/graph.html].
|
243
244
|
|
244
245
|
Call graphs output results in the calltree profile format which is used
|
245
246
|
by KCachegrind. Call graph support was generously donated by Carl
|
@@ -249,13 +250,13 @@ site.
|
|
249
250
|
|
250
251
|
Call stack reports produce a HTML visualization of the time spent in
|
251
252
|
each execution path of the profiled code. An example can be found at
|
252
|
-
{examples/stack.html}[http://github.com/
|
253
|
+
{examples/stack.html}[http://github.com/ruby-prof/ruby-prof/tree/master/examples/call_stack.html].
|
253
254
|
|
254
255
|
Another good example: [http://twitpic.com/28z94a]
|
255
256
|
|
256
257
|
Finally, there's a so called MultiPrinter which can generate several
|
257
258
|
reports in one profiling run. See
|
258
|
-
{examples/multi.stack.html}[http://github.com/
|
259
|
+
{examples/multi.stack.html}[http://github.com/ruby-prof/ruby-prof/tree/master/examples/multi.stack.html].
|
259
260
|
|
260
261
|
There is also a graphviz .dot visualiser.
|
261
262
|
|
@@ -427,6 +428,6 @@ See LICENSE for license information.
|
|
427
428
|
|
428
429
|
== Development
|
429
430
|
|
430
|
-
Code is located at
|
431
|
+
Code is located at https://github.com/ruby-prof/ruby-prof
|
431
432
|
|
432
|
-
Google group/mailing list: http://groups.google.com/group/ruby-optimization
|
433
|
+
Google group/mailing list: http://groups.google.com/group/ruby-optimization or start a github issue.
|
data/doc/LICENSE.html
CHANGED
@@ -131,11 +131,11 @@ this list of conditions and the following disclaimer in the documentation
|
|
131
131
|
and/or other materials provided with the distribution.</p>
|
132
132
|
</li></ol>
|
133
133
|
|
134
|
-
<p>THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS “AS IS
|
135
|
-
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
136
|
-
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
137
|
-
DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
138
|
-
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
134
|
+
<p>THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS “AS IS''
|
135
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
136
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
137
|
+
ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
138
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
139
139
|
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
140
140
|
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
141
141
|
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
data/doc/README_rdoc.html
CHANGED
@@ -119,6 +119,10 @@
|
|
119
119
|
|
120
120
|
<h1 id="label-ruby-prof">ruby-prof</h1>
|
121
121
|
|
122
|
+
<p><a href="https://travis-ci.org/ruby-prof/ruby-prof"><img
|
123
|
+
src="https://travis-ci.org/ruby-prof/ruby-prof.png?branch=master"
|
124
|
+
alt="Build Status" /></a></p>
|
125
|
+
|
122
126
|
<h2 id="label-Overview">Overview</h2>
|
123
127
|
|
124
128
|
<p>ruby-prof is a fast code profiler for Ruby. Its features include:</p>
|
@@ -151,8 +155,8 @@ href="README_rdoc.html">README</a>.</p>
|
|
151
155
|
|
152
156
|
<p>ruby-prof requires Ruby 1.8.7 or 1.9.2 and higher.</p>
|
153
157
|
|
154
|
-
<p>If you are running Linux or Unix you
|
155
|
-
can be compiled when it is installed.</p>
|
158
|
+
<p>If you are running Linux or Unix you'll need a C compiler so the
|
159
|
+
extension can be compiled when it is installed.</p>
|
156
160
|
|
157
161
|
<p>If you are running Windows, then you may need to install the Windows
|
158
162
|
specific RubyGem which includes an already built extension (see Install
|
@@ -164,8 +168,8 @@ section).</p>
|
|
164
168
|
|
165
169
|
<pre>gem install ruby-prof</pre>
|
166
170
|
|
167
|
-
<p>If you
|
168
|
-
course compile it yourself via use of devkit on MinGW.</p>
|
171
|
+
<p>If you're on windows then a prebuilt binary gem is available. You may
|
172
|
+
of course compile it yourself via use of devkit on MinGW.</p>
|
169
173
|
|
170
174
|
<h2 id="label-Usage">Usage</h2>
|
171
175
|
|
@@ -182,7 +186,7 @@ For more information refer to the documentation of the ruby-prof command.</p>
|
|
182
186
|
<p>The second way is to use the ruby-prof API to profile particular segments
|
183
187
|
of code.</p>
|
184
188
|
|
185
|
-
<pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string"
|
189
|
+
<pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">'ruby-prof'</span>
|
186
190
|
|
187
191
|
<span class="ruby-comment"># Profile the code</span>
|
188
192
|
<span class="ruby-constant">RubyProf</span>.<span class="ruby-identifier">start</span>
|
@@ -198,7 +202,7 @@ of code.</p>
|
|
198
202
|
|
199
203
|
<p>Alternatively, you can use a block to tell ruby-prof what to profile:</p>
|
200
204
|
|
201
|
-
<pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string"
|
205
|
+
<pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">'ruby-prof'</span>
|
202
206
|
|
203
207
|
<span class="ruby-comment"># Profile the code</span>
|
204
208
|
<span class="ruby-identifier">result</span> = <span class="ruby-constant">RubyProf</span>.<span class="ruby-identifier">profile</span> <span class="ruby-keyword">do</span>
|
@@ -214,7 +218,7 @@ of code.</p>
|
|
214
218
|
|
215
219
|
<p>ruby-prof also supports pausing and resuming profiling runs.</p>
|
216
220
|
|
217
|
-
<pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string"
|
221
|
+
<pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">'ruby-prof'</span>
|
218
222
|
|
219
223
|
<span class="ruby-comment"># Profile the code</span>
|
220
224
|
<span class="ruby-constant">RubyProf</span>.<span class="ruby-identifier">start</span>
|
@@ -229,7 +233,7 @@ of code.</p>
|
|
229
233
|
<p>Note that resume will automatically call start if a profiling run has not
|
230
234
|
yet started. In addition, resume can also take a block:</p>
|
231
235
|
|
232
|
-
<pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string"
|
236
|
+
<pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">'ruby-prof'</span>
|
233
237
|
|
234
238
|
<span class="ruby-comment"># Profile the code</span>
|
235
239
|
<span class="ruby-constant">RubyProf</span>.<span class="ruby-identifier">resume</span> <span class="ruby-keyword">do</span>
|
@@ -249,10 +253,10 @@ results. This is useful for reducing connectivity in the call graph, making
|
|
249
253
|
it easier to identify the source of performance problems when using a graph
|
250
254
|
printer.</p>
|
251
255
|
|
252
|
-
<p>For example, consider Integer#times: it
|
253
|
-
much time is spent in the method itself. We
|
254
|
-
much the passed in block contributes to the time spent in the method
|
255
|
-
contains the Integer#times call.</p>
|
256
|
+
<p>For example, consider Integer#times: it's hardly ever useful to know
|
257
|
+
how much time is spent in the method itself. We're much more interested
|
258
|
+
in how much the passed in block contributes to the time spent in the method
|
259
|
+
which contains the Integer#times call.</p>
|
256
260
|
|
257
261
|
<p>Methods are eliminated from the collected data by calling
|
258
262
|
`eliminate_methods!` on the profiling result, before submitting it to a
|
@@ -279,9 +283,10 @@ profiling.</p>
|
|
279
283
|
|
280
284
|
<h2 id="label-Benchmarking+full+load+time+including+rubygems+startup+cost+%3D%3D">Benchmarking full load time including rubygems startup cost ==</h2>
|
281
285
|
|
282
|
-
<p>If you want to get a more accurate measurement of what takes all of a
|
283
|
-
bin/xxx command to load, you may want to also measure
|
284
|
-
penalty. You can do this by calling into
|
286
|
+
<p>If you want to get a more accurate measurement of what takes all of a
|
287
|
+
gem's bin/xxx command to load, you may want to also measure
|
288
|
+
rubygems' startup penalty. You can do this by calling into
|
289
|
+
bin/ruby-prof directly, ex:</p>
|
285
290
|
|
286
291
|
<p>$ gem which ruby-prof</p>
|
287
292
|
|
@@ -299,26 +304,28 @@ g:192binsome_installed_gem_command</p>
|
|
299
304
|
|
300
305
|
<h2 id="label-Profiling+Tests">Profiling Tests</h2>
|
301
306
|
|
302
|
-
<p>ruby-prof supports profiling tests cases written using Ruby
|
303
|
-
test framework (ie, test derived from Test::Unit::TestCase). To
|
304
|
-
profiling simply add the following line of code to within your test
|
307
|
+
<p>ruby-prof supports profiling tests cases written using Ruby's built-in
|
308
|
+
unit test framework (ie, test derived from Test::Unit::TestCase). To
|
309
|
+
enable profiling simply add the following line of code to within your test
|
310
|
+
class:</p>
|
305
311
|
|
306
312
|
<pre>include RubyProf::Test</pre>
|
307
313
|
|
308
314
|
<p>Each test method is profiled separately. ruby-prof will run each test
|
309
315
|
method once as a warmup and then ten additional times to gather profile
|
310
316
|
data. Note that the profile data will <strong>not</strong> include the
|
311
|
-
class
|
317
|
+
class's setup or teardown methods.</p>
|
312
318
|
|
313
319
|
<p>Separate reports are generated for each method and saved, by default, in
|
314
|
-
the test process
|
315
|
-
options, modify your test class
|
316
|
-
change test profiling options, modify
|
320
|
+
the test process's working directory. To change this, or other
|
321
|
+
profiling options, modify your test class's PROFILE_OPTIONS hash table.
|
322
|
+
To globally change test profiling options, modify
|
323
|
+
RubyProf::Test::PROFILE_OPTIONS.</p>
|
317
324
|
|
318
325
|
<h2 id="label-Profiling+Rails">Profiling Rails</h2>
|
319
326
|
|
320
327
|
<p>To profile a Rails application it is vital to run it using production like
|
321
|
-
settings (cache classes, cache view lookups, etc.). Otherwise, Rail
|
328
|
+
settings (cache classes, cache view lookups, etc.). Otherwise, Rail's
|
322
329
|
dependency loading code will overwhelm any time spent in the application
|
323
330
|
itself (our tests show that Rails dependency loading causes a roughly 6x
|
324
331
|
slowdown). The best way to do this is create a new Rails environment,
|
@@ -334,14 +341,14 @@ likely turn off caching.</p>
|
|
334
341
|
<p>Add the ruby-prof to your gemfile:</p>
|
335
342
|
|
336
343
|
<pre>group :profile do
|
337
|
-
gem
|
344
|
+
gem 'ruby-prof'
|
338
345
|
end</pre>
|
339
346
|
</li><li>
|
340
347
|
<p>Add the ruby prof rack adapter to your middleware stack. One way to do
|
341
348
|
this is by adding the following code to config.ru:</p>
|
342
349
|
|
343
350
|
<pre class="ruby"><span class="ruby-keyword">if</span> <span class="ruby-constant">Rails</span>.<span class="ruby-identifier">env</span>.<span class="ruby-identifier">profile?</span>
|
344
|
-
<span class="ruby-identifier">use</span> <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">RubyProf</span>, :<span class="ruby-identifier">path</span> =<span class="ruby-operator">></span> <span class="ruby-string"
|
351
|
+
<span class="ruby-identifier">use</span> <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">RubyProf</span>, :<span class="ruby-identifier">path</span> =<span class="ruby-operator">></span> <span class="ruby-string">'/temp/profile'</span>
|
345
352
|
<span class="ruby-keyword">end</span>
|
346
353
|
</pre>
|
347
354
|
|
@@ -373,7 +380,7 @@ profiling reports created by the previous request!</p>
|
|
373
380
|
<p>Flat profiles show the overall time spent in each method. They are a good
|
374
381
|
of quickly identifying which methods take the most time. An example of a
|
375
382
|
flat profile and an explanation can be found in <a
|
376
|
-
href="http://github.com/
|
383
|
+
href="http://github.com/ruby-prof/ruby-prof/tree/master/examples/flat.txt">examples/flat.txt</a>.</p>
|
377
384
|
|
378
385
|
<p>There are several varieties of these – run $ ruby-prof –help</p>
|
379
386
|
|
@@ -382,13 +389,13 @@ addition, they also show which methods call the current method and which
|
|
382
389
|
methods its calls. Thus they are good for understanding how methods gets
|
383
390
|
called and provide insight into the flow of your program. An example text
|
384
391
|
graph profile is located at <a
|
385
|
-
href="http://github.com/
|
392
|
+
href="http://github.com/ruby-prof/ruby-prof/tree/master/examples/graph.txt">examples/graph.txt</a>.</p>
|
386
393
|
|
387
394
|
<p>HTML Graph profiles are the same as graph profiles, except output is
|
388
395
|
generated in hyper-linked HTML. Since graph profiles can be quite large,
|
389
396
|
the embedded links make it much easier to navigate the results. An example
|
390
397
|
html graph profile is located at <a
|
391
|
-
href="http://github.com/
|
398
|
+
href="http://github.com/ruby-prof/ruby-prof/tree/master/examples/graph.html">examples/graph.html</a>.</p>
|
392
399
|
|
393
400
|
<p>Call graphs output results in the calltree profile format which is used by
|
394
401
|
KCachegrind. Call graph support was generously donated by Carl Shimer. More
|
@@ -398,14 +405,14 @@ site.</p>
|
|
398
405
|
|
399
406
|
<p>Call stack reports produce a HTML visualization of the time spent in each
|
400
407
|
execution path of the profiled code. An example can be found at <a
|
401
|
-
href="http://github.com/
|
408
|
+
href="http://github.com/ruby-prof/ruby-prof/tree/master/examples/call_stack.html">examples/stack.html</a>.</p>
|
402
409
|
|
403
410
|
<p>Another good example: [<a
|
404
411
|
href="http://twitpic.com/28z94a">twitpic.com/28z94a</a>]</p>
|
405
412
|
|
406
|
-
<p>Finally, there
|
413
|
+
<p>Finally, there's a so called MultiPrinter which can generate several
|
407
414
|
reports in one profiling run. See <a
|
408
|
-
href="http://github.com/
|
415
|
+
href="http://github.com/ruby-prof/ruby-prof/tree/master/examples/multi.stack.html">examples/multi.stack.html</a>.</p>
|
409
416
|
|
410
417
|
<p>There is also a graphviz .dot visualiser.</p>
|
411
418
|
|
@@ -427,7 +434,7 @@ call graph report in text format</p>
|
|
427
434
|
Creates a call graph report in HTML (separate files per thread)</p>
|
428
435
|
</li><li>
|
429
436
|
<p><a href="RubyProf/DotPrinter.html">RubyProf::DotPrinter</a> - Creates a
|
430
|
-
call graph report in GraphViz
|
437
|
+
call graph report in GraphViz's DOT format which can be converted to an
|
431
438
|
image</p>
|
432
439
|
</li><li>
|
433
440
|
<p><a href="RubyProf/CallTreePrinter.html">RubyProf::CallTreePrinter</a> -
|
@@ -497,8 +504,8 @@ significant CPU or disk time during a profiling run then the reported
|
|
497
504
|
results will be too large.</p>
|
498
505
|
|
499
506
|
<p>CPU time uses the CPU clock counter to measure time. The returned values
|
500
|
-
are dependent on the correctly setting the CPU
|
501
|
-
only supported on Pentium or PowerPC platforms (linux only).</p>
|
507
|
+
are dependent on the correctly setting the CPU's frequency. This mode
|
508
|
+
is only supported on Pentium or PowerPC platforms (linux only).</p>
|
502
509
|
|
503
510
|
<p>Object allocation reports show how many objects each method in a program
|
504
511
|
allocates. This support was added by Sylvain Joyeux and requires a patched
|
@@ -510,16 +517,16 @@ This support was added by Alexander Dymo and requires a patched Ruby
|
|
510
517
|
interpreter. For more information, see: <a
|
511
518
|
href="http://rubyforge.org/tracker/index.php?func=detail&aid=17676&group_id=1814&atid=7062">rubyforge.org/tracker/index.php?func=detail&aid=17676&group_id=1814&atid=7062</a></p>
|
512
519
|
|
513
|
-
<p>Garbage collection runs report how many times Ruby
|
514
|
-
invoked during a profiling session. This support was added by Jeremy
|
520
|
+
<p>Garbage collection runs report how many times Ruby's garbage collector
|
521
|
+
is invoked during a profiling session. This support was added by Jeremy
|
515
522
|
Kemper and requires a patched Ruby interpreter. For more information, see:
|
516
523
|
<a
|
517
524
|
href="http://rubyforge.org/tracker/index.php?func=detail&aid=17676&group_id=1814&atid=7062">rubyforge.org/tracker/index.php?func=detail&aid=17676&group_id=1814&atid=7062</a></p>
|
518
525
|
|
519
|
-
<p>Garbage collection time reports how much time is spent in Ruby
|
520
|
-
collector during a profiling session. This support was added by
|
521
|
-
Kemper and requires a patched Ruby interpreter. For more
|
522
|
-
<a
|
526
|
+
<p>Garbage collection time reports how much time is spent in Ruby's
|
527
|
+
garbage collector during a profiling session. This support was added by
|
528
|
+
Jeremy Kemper and requires a patched Ruby interpreter. For more
|
529
|
+
information, see: <a
|
523
530
|
href="http://rubyforge.org/tracker/index.php?func=detail&aid=17676&group_id=1814&atid=7062">rubyforge.org/tracker/index.php?func=detail&aid=17676&group_id=1814&atid=7062</a></p>
|
524
531
|
|
525
532
|
<p>To set the measurement:</p>
|
@@ -586,7 +593,7 @@ profiling run and is otherwise quiescent.</p>
|
|
586
593
|
|
587
594
|
<p>On both platforms, cpu time is measured using the RDTSC assembly function
|
588
595
|
provided by the Pentium and PowerPC platforms. CPU time is dependent on the
|
589
|
-
cpu
|
596
|
+
cpu's frequency. On Linux, ruby-prof attempts to read this value from
|
590
597
|
“/proc/cpuinfo.” On Windows, you must manually specify the clock
|
591
598
|
frequency. This can be done using the RUBY_PROF_CPU_FREQUENCY environment
|
592
599
|
variable:</p>
|
@@ -603,18 +610,18 @@ variable:</p>
|
|
603
610
|
context switches in 1.8. As a result, the timings ruby-prof reports for
|
604
611
|
each thread may be slightly inaccurate. In particular, this will happen
|
605
612
|
for newly spawned threads that go to sleep immediately (their first call).
|
606
|
-
For instance, if you use Ruby
|
607
|
-
2 seconds will be assigned to the foreground thread and not the newly
|
613
|
+
For instance, if you use Ruby's timeout library to wait for 2 seconds,
|
614
|
+
the 2 seconds will be assigned to the foreground thread and not the newly
|
608
615
|
created background thread. These errors can largely be avoided if the
|
609
616
|
background thread performs any operation before going to sleep.</p>
|
610
617
|
|
611
618
|
<h2 id="label-Performance">Performance</h2>
|
612
619
|
|
613
|
-
<p>Significant effort has been put into reducing ruby-prof
|
614
|
-
as possible. Our tests show that the overhead associated with
|
615
|
-
code varies considerably with the code being profiled. Most
|
616
|
-
run approximately twice as slow while highly recursive
|
617
|
-
fibonacci series test) will run three times slower.</p>
|
620
|
+
<p>Significant effort has been put into reducing ruby-prof's overhead as
|
621
|
+
much as possible. Our tests show that the overhead associated with
|
622
|
+
profiling code varies considerably with the code being profiled. Most
|
623
|
+
programs will run approximately twice as slow while highly recursive
|
624
|
+
programs (like the fibonacci series test) will run three times slower.</p>
|
618
625
|
|
619
626
|
<h2 id="label-License">License</h2>
|
620
627
|
|
@@ -623,10 +630,11 @@ fibonacci series test) will run three times slower.</p>
|
|
623
630
|
<h2 id="label-Development">Development</h2>
|
624
631
|
|
625
632
|
<p>Code is located at <a
|
626
|
-
href="
|
633
|
+
href="https://github.com/ruby-prof/ruby-prof">github.com/ruby-prof/ruby-prof</a></p>
|
627
634
|
|
628
635
|
<p>Google group/mailing list: <a
|
629
|
-
href="http://groups.google.com/group/ruby-optimization">groups.google.com/group/ruby-optimization</a
|
636
|
+
href="http://groups.google.com/group/ruby-optimization">groups.google.com/group/ruby-optimization</a>
|
637
|
+
or start a github issue.</p>
|
630
638
|
|
631
639
|
</div>
|
632
640
|
|
data/doc/Rack/RubyProf.html
CHANGED
@@ -200,10 +200,10 @@
|
|
200
200
|
<span class="ruby-ivar">@options</span> = <span class="ruby-identifier">options</span>
|
201
201
|
<span class="ruby-ivar">@options</span>[<span class="ruby-value">:min_percent</span>] <span class="ruby-operator">||=</span> <span class="ruby-value">1</span>
|
202
202
|
<span class="ruby-ivar">@tmpdir</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:path</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">tmpdir</span>
|
203
|
-
<span class="ruby-ivar">@printer_klasses</span> = <span class="ruby-ivar">@options</span>[<span class="ruby-value">:printers</span>] <span class="ruby-operator">||</span> {<span class="ruby-operator">::</span><span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">FlatPrinter</span> =<span class="ruby-operator">></span> <span class="ruby-string"
|
204
|
-
<span class="ruby-operator">::</span><span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">GraphPrinter</span> =<span class="ruby-operator">></span> <span class="ruby-string"
|
205
|
-
<span class="ruby-operator">::</span><span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">GraphHtmlPrinter</span> =<span class="ruby-operator">></span> <span class="ruby-string"
|
206
|
-
<span class="ruby-operator">::</span><span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">CallStackPrinter</span> =<span class="ruby-operator">></span> <span class="ruby-string"
|
203
|
+
<span class="ruby-ivar">@printer_klasses</span> = <span class="ruby-ivar">@options</span>[<span class="ruby-value">:printers</span>] <span class="ruby-operator">||</span> {<span class="ruby-operator">::</span><span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">FlatPrinter</span> =<span class="ruby-operator">></span> <span class="ruby-string">'flat.txt'</span>,
|
204
|
+
<span class="ruby-operator">::</span><span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">GraphPrinter</span> =<span class="ruby-operator">></span> <span class="ruby-string">'graph.txt'</span>,
|
205
|
+
<span class="ruby-operator">::</span><span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">GraphHtmlPrinter</span> =<span class="ruby-operator">></span> <span class="ruby-string">'graph.html'</span>,
|
206
|
+
<span class="ruby-operator">::</span><span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">CallStackPrinter</span> =<span class="ruby-operator">></span> <span class="ruby-string">'call_stack.html'</span>}
|
207
207
|
|
208
208
|
<span class="ruby-ivar">@skip_paths</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:skip_paths</span>] <span class="ruby-operator">||</span> [<span class="ruby-regexp">%r{^/assets}</span>, <span class="ruby-regexp">%r{\.css$}</span>, <span class="ruby-regexp">%r{\.js$}</span>, <span class="ruby-regexp">%r{\.png$}</span>, <span class="ruby-regexp">%r{\.jpeg$}</span>, <span class="ruby-regexp">%r{\.jpg$}</span>, <span class="ruby-regexp">%r{\.gif$}</span>]
|
209
209
|
<span class="ruby-keyword">end</span></pre>
|
@@ -251,7 +251,7 @@
|
|
251
251
|
<span class="ruby-identifier">result</span> = <span class="ruby-ivar">@app</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
|
252
252
|
<span class="ruby-keyword">end</span>
|
253
253
|
|
254
|
-
<span class="ruby-identifier">path</span> = <span class="ruby-identifier">request</span>.<span class="ruby-identifier">path</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-string"
|
254
|
+
<span class="ruby-identifier">path</span> = <span class="ruby-identifier">request</span>.<span class="ruby-identifier">path</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-string">'/'</span>, <span class="ruby-string">'-'</span>)
|
255
255
|
<span class="ruby-identifier">path</span>.<span class="ruby-identifier">slice!</span>(<span class="ruby-value">0</span>)
|
256
256
|
|
257
257
|
<span class="ruby-identifier">print</span>(<span class="ruby-identifier">data</span>, <span class="ruby-identifier">path</span>)
|
@@ -289,7 +289,7 @@
|
|
289
289
|
<span class="ruby-ivar">@printer_klasses</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">printer_klass</span>, <span class="ruby-identifier">base_name</span><span class="ruby-operator">|</span>
|
290
290
|
<span class="ruby-identifier">printer</span> = <span class="ruby-identifier">printer_klass</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">data</span>)
|
291
291
|
<span class="ruby-identifier">file_name</span> = <span class="ruby-operator">::</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-ivar">@tmpdir</span>, <span class="ruby-node">"#{path}-#{base_name}"</span>)
|
292
|
-
<span class="ruby-operator">::</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">file_name</span>, <span class="ruby-string"
|
292
|
+
<span class="ruby-operator">::</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">file_name</span>, <span class="ruby-string">'wb'</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">file</span><span class="ruby-operator">|</span>
|
293
293
|
<span class="ruby-identifier">printer</span>.<span class="ruby-identifier">print</span>(<span class="ruby-identifier">file</span>, <span class="ruby-ivar">@options</span>)
|
294
294
|
<span class="ruby-keyword">end</span>
|
295
295
|
<span class="ruby-keyword">end</span>
|
data/doc/RubyProf.html
CHANGED
@@ -209,10 +209,11 @@
|
|
209
209
|
|
210
210
|
<div id="description" class="description">
|
211
211
|
|
212
|
-
<p>The call info visitor class does a depth-first traversal across a
|
213
|
-
call stack. At each call_info node, the visitor executes the
|
214
|
-
provided in the visit method. The block is passed two parameters,
|
215
|
-
event and the call_info instance. Event will be either :enter or
|
212
|
+
<p>The call info visitor class does a depth-first traversal across a
|
213
|
+
thread's call stack. At each call_info node, the visitor executes the
|
214
|
+
block provided in the visit method. The block is passed two parameters,
|
215
|
+
the event and the call_info instance. Event will be either :enter or
|
216
|
+
:exit.</p>
|
216
217
|
|
217
218
|
<pre class="ruby"><span class="ruby-identifier">visitor</span> = <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">CallInfoVisitor</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">result</span>.<span class="ruby-identifier">threads</span>.<span class="ruby-identifier">first</span>)
|
218
219
|
|
@@ -510,7 +510,7 @@ options.</p>
|
|
510
510
|
for it to be printed out in the report.
|
511
511
|
Default value is 0.
|
512
512
|
|
513
|
-
:print_file - True or false. Specifies if a method
|
513
|
+
:print_file - True or false. Specifies if a method's source
|
514
514
|
file should be printed. Default value if false.
|
515
515
|
|
516
516
|
:sort_method - Specifies method used for sorting method infos.
|
data/doc/RubyProf/CallInfo.html
CHANGED
@@ -227,7 +227,7 @@
|
|
227
227
|
<pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line 25</span>
|
228
228
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">call_sequence</span>
|
229
229
|
<span class="ruby-ivar">@call_sequence</span> <span class="ruby-operator">||=</span> <span class="ruby-keyword">begin</span>
|
230
|
-
<span class="ruby-identifier">stack</span>.<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">method</span><span class="ruby-operator">|</span> <span class="ruby-identifier">method</span>.<span class="ruby-identifier">full_name</span>}.<span class="ruby-identifier">join</span>(<span class="ruby-string"
|
230
|
+
<span class="ruby-identifier">stack</span>.<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">method</span><span class="ruby-operator">|</span> <span class="ruby-identifier">method</span>.<span class="ruby-identifier">full_name</span>}.<span class="ruby-identifier">join</span>(<span class="ruby-string">'->'</span>)
|
231
231
|
<span class="ruby-keyword">end</span>
|
232
232
|
<span class="ruby-keyword">end</span></pre>
|
233
233
|
</div><!-- call_sequence-source -->
|
@@ -329,7 +329,7 @@ from both praent end self.</p>
|
|
329
329
|
<div class="method-description">
|
330
330
|
|
331
331
|
<p>find a specific call in list of children. returns nil if not found. note:
|
332
|
-
there can
|
332
|
+
there can't be more than one child with a given target method. in other
|
333
333
|
words: x.children.grep{|y|y.target==m}.size <= 1 for all method infos m
|
334
334
|
and call infos x</p>
|
335
335
|
|
@@ -146,7 +146,7 @@
|
|
146
146
|
|
147
147
|
<p>Prints out the call graph based on <a href="CallInfo.html">CallInfo</a>
|
148
148
|
instances. This is mainly for debugging purposes as it provides access
|
149
|
-
into into RubyProf
|
149
|
+
into into RubyProf's internals.</p>
|
150
150
|
|
151
151
|
</div><!-- description -->
|
152
152
|
|
@@ -280,7 +280,7 @@
|
|
280
280
|
<div class="method-source-code" id="arguments-source">
|
281
281
|
<pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 166</span>
|
282
282
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">arguments</span>
|
283
|
-
<span class="ruby-constant">ARGV</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string"
|
283
|
+
<span class="ruby-constant">ARGV</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">' '</span>)
|
284
284
|
<span class="ruby-keyword">end</span></pre>
|
285
285
|
</div><!-- arguments-source -->
|
286
286
|
|
@@ -351,7 +351,7 @@
|
|
351
351
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">copy_image_files</span>
|
352
352
|
<span class="ruby-keyword">if</span> <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">File</span>)
|
353
353
|
<span class="ruby-identifier">target_dir</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-ivar">@output</span>.<span class="ruby-identifier">path</span>)
|
354
|
-
<span class="ruby-identifier">image_dir</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-keyword">__FILE__</span>), <span class="ruby-string"
|
354
|
+
<span class="ruby-identifier">image_dir</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-keyword">__FILE__</span>), <span class="ruby-string">'..'</span>, <span class="ruby-string">'images'</span>)
|
355
355
|
<span class="ruby-node">%w(empty plus minus)</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">img</span><span class="ruby-operator">|</span>
|
356
356
|
<span class="ruby-identifier">source_file</span> = <span class="ruby-node">"#{image_dir}/#{img}.png"</span>
|
357
357
|
<span class="ruby-identifier">target_file</span> = <span class="ruby-node">"#{target_dir}/#{img}.png"</span>
|
@@ -449,7 +449,7 @@
|
|
449
449
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">graph_link</span>(<span class="ruby-identifier">call_info</span>)
|
450
450
|
<span class="ruby-identifier">total_calls</span> = <span class="ruby-identifier">call_info</span>.<span class="ruby-identifier">target</span>.<span class="ruby-identifier">call_infos</span>.<span class="ruby-identifier">inject</span>(<span class="ruby-value">0</span>){<span class="ruby-operator">|</span><span class="ruby-identifier">t</span>, <span class="ruby-identifier">ci</span><span class="ruby-operator">|</span> <span class="ruby-identifier">t</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">ci</span>.<span class="ruby-identifier">called</span>}
|
451
451
|
<span class="ruby-identifier">href</span> = <span class="ruby-node">"#{@graph_html}##{method_href(call_info.target)}"</span>
|
452
|
-
<span class="ruby-identifier">totals</span> = <span class="ruby-ivar">@graph_html</span> <span class="ruby-operator">?</span> <span class="ruby-node">"<a href
|
452
|
+
<span class="ruby-identifier">totals</span> = <span class="ruby-ivar">@graph_html</span> <span class="ruby-operator">?</span> <span class="ruby-node">"<a href='#{href}'>#{total_calls}</a>"</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">total_calls</span>.<span class="ruby-identifier">to_s</span>
|
453
453
|
<span class="ruby-node">"[#{call_info.called} calls, #{totals} total]"</span>
|
454
454
|
<span class="ruby-keyword">end</span></pre>
|
455
455
|
</div><!-- graph_link-source -->
|
@@ -584,7 +584,7 @@
|
|
584
584
|
for it to be printed out in the report.
|
585
585
|
Default value is 0.
|
586
586
|
|
587
|
-
:print_file - True or false. Specifies if a method
|
587
|
+
:print_file - True or false. Specifies if a method's source
|
588
588
|
file should be printed. Default value if false.
|
589
589
|
|
590
590
|
:threshold - a float from 0 to 100 that sets the threshold of
|
@@ -838,7 +838,7 @@ input { margin-left:10px; }
|
|
838
838
|
<div class="method-source-code" id="print_footer-source">
|
839
839
|
<pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 206</span>
|
840
840
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">print_footer</span>
|
841
|
-
<span class="ruby-ivar">@output</span>.<span class="ruby-identifier">puts</span> <span class="ruby-string"
|
841
|
+
<span class="ruby-ivar">@output</span>.<span class="ruby-identifier">puts</span> <span class="ruby-string">'<div id="sentinel"></div></div></body></html>'</span>
|
842
842
|
<span class="ruby-keyword">end</span></pre>
|
843
843
|
</div><!-- print_footer-source -->
|
844
844
|
|
@@ -869,11 +869,11 @@ input { margin-left:10px; }
|
|
869
869
|
<pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 194</span>
|
870
870
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">print_header</span>
|
871
871
|
<span class="ruby-ivar">@output</span>.<span class="ruby-identifier">puts</span> <span class="ruby-string">"<html><head>"</span>
|
872
|
-
<span class="ruby-ivar">@output</span>.<span class="ruby-identifier">puts</span> <span class="ruby-string"
|
872
|
+
<span class="ruby-ivar">@output</span>.<span class="ruby-identifier">puts</span> <span class="ruby-string">'<meta http-equiv="content-type" content="text/html; charset=utf-8">'</span>
|
873
873
|
<span class="ruby-ivar">@output</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">"<title>#{h title}</title>"</span>
|
874
874
|
<span class="ruby-identifier">print_css</span>
|
875
875
|
<span class="ruby-identifier">print_java_script</span>
|
876
|
-
<span class="ruby-ivar">@output</span>.<span class="ruby-identifier">puts</span> <span class="ruby-string"
|
876
|
+
<span class="ruby-ivar">@output</span>.<span class="ruby-identifier">puts</span> <span class="ruby-string">'</head><body><div style="display: inline-block;">'</span>
|
877
877
|
<span class="ruby-identifier">print_title_bar</span>
|
878
878
|
<span class="ruby-identifier">print_commands</span>
|
879
879
|
<span class="ruby-identifier">print_help</span>
|
@@ -985,7 +985,7 @@ function findUlChild(li){
|
|
985
985
|
|
986
986
|
function isLeafNode(li) {
|
987
987
|
var img = li.firstChild;
|
988
|
-
return (img.src.indexOf(
|
988
|
+
return (img.src.indexOf('empty.png') > -1);
|
989
989
|
}
|
990
990
|
|
991
991
|
function hideLI(li) {
|
@@ -993,11 +993,11 @@ function hideLI(li) {
|
|
993
993
|
return;
|
994
994
|
|
995
995
|
var img = li.firstChild;
|
996
|
-
img.src =
|
996
|
+
img.src = 'plus.png';
|
997
997
|
|
998
998
|
var ul = findUlChild(li);
|
999
999
|
if (ul) {
|
1000
|
-
ul.style.display =
|
1000
|
+
ul.style.display = 'none';
|
1001
1001
|
hideUL(ul);
|
1002
1002
|
}
|
1003
1003
|
}
|
@@ -1007,11 +1007,11 @@ function showLI(li) {
|
|
1007
1007
|
return;
|
1008
1008
|
|
1009
1009
|
var img = li.firstChild;
|
1010
|
-
img.src =
|
1010
|
+
img.src = 'minus.png';
|
1011
1011
|
|
1012
1012
|
var ul = findUlChild(li);
|
1013
1013
|
if (ul) {
|
1014
|
-
ul.style.display =
|
1014
|
+
ul.style.display = 'block';
|
1015
1015
|
showUL(ul);
|
1016
1016
|
}
|
1017
1017
|
}
|
@@ -1028,7 +1028,7 @@ function toggleLI(li) {
|
|
1028
1028
|
|
1029
1029
|
function aboveThreshold(text, threshold) {
|
1030
1030
|
var match = text.match(/\d+[.,]\d+/);
|
1031
|
-
return (match && parseFloat(match[0].replace(/,/,
|
1031
|
+
return (match && parseFloat(match[0].replace(/,/, '.'))>=threshold);
|
1032
1032
|
}
|
1033
1033
|
|
1034
1034
|
function setThresholdLI(li, threshold) {
|
@@ -1043,16 +1043,16 @@ function setThresholdLI(li, threshold) {
|
|
1043
1043
|
count = setThresholdUL(ul, threshold);
|
1044
1044
|
}
|
1045
1045
|
if (count>0) {
|
1046
|
-
img.src =
|
1046
|
+
img.src = 'minus.png';
|
1047
1047
|
}
|
1048
1048
|
else {
|
1049
|
-
img.src =
|
1049
|
+
img.src = 'empty.png';
|
1050
1050
|
}
|
1051
1051
|
if (visible) {
|
1052
|
-
li.style.display =
|
1052
|
+
li.style.display = 'block'
|
1053
1053
|
}
|
1054
1054
|
else {
|
1055
|
-
li.style.display =
|
1055
|
+
li.style.display = 'none'
|
1056
1056
|
}
|
1057
1057
|
return visible;
|
1058
1058
|
}
|
@@ -1068,10 +1068,10 @@ function setThresholdUL(node, threshold) {
|
|
1068
1068
|
|
1069
1069
|
var visible = (count > 0) ? 1 : 0;
|
1070
1070
|
if (visible) {
|
1071
|
-
node.style.display =
|
1071
|
+
node.style.display = 'block';
|
1072
1072
|
}
|
1073
1073
|
else {
|
1074
|
-
node.style.display =
|
1074
|
+
node.style.display = 'none';
|
1075
1075
|
}
|
1076
1076
|
return visible;
|
1077
1077
|
}
|
@@ -1079,24 +1079,24 @@ function setThresholdUL(node, threshold) {
|
|
1079
1079
|
function toggleChildren(img, event) {
|
1080
1080
|
event.cancelBubble=true;
|
1081
1081
|
|
1082
|
-
if (img.src.indexOf(
|
1082
|
+
if (img.src.indexOf('empty.png') > -1)
|
1083
1083
|
return;
|
1084
1084
|
|
1085
|
-
var minus = (img.src.indexOf(
|
1085
|
+
var minus = (img.src.indexOf('minus.png') > -1);
|
1086
1086
|
|
1087
1087
|
if (minus) {
|
1088
|
-
img.src =
|
1088
|
+
img.src = 'plus.png';
|
1089
1089
|
}
|
1090
1090
|
else
|
1091
|
-
img.src =
|
1091
|
+
img.src = 'minus.png';
|
1092
1092
|
|
1093
1093
|
var li = img.parentNode;
|
1094
1094
|
var ul = findUlChild(li);
|
1095
1095
|
if (ul) {
|
1096
1096
|
if (minus)
|
1097
|
-
ul.style.display =
|
1097
|
+
ul.style.display = 'none';
|
1098
1098
|
else
|
1099
|
-
ul.style.display =
|
1099
|
+
ul.style.display = 'block';
|
1100
1100
|
}
|
1101
1101
|
if (minus)
|
1102
1102
|
moveSelectionIfNecessary(li);
|
@@ -1104,27 +1104,27 @@ function toggleChildren(img, event) {
|
|
1104
1104
|
|
1105
1105
|
function showChildren(li) {
|
1106
1106
|
var img = li.firstChild;
|
1107
|
-
if (img.src.indexOf(
|
1107
|
+
if (img.src.indexOf('empty.png') > -1)
|
1108
1108
|
return;
|
1109
|
-
img.src =
|
1109
|
+
img.src = 'minus.png';
|
1110
1110
|
|
1111
1111
|
var ul = findUlChild(li);
|
1112
1112
|
if (ul) {
|
1113
|
-
ul.style.display =
|
1113
|
+
ul.style.display = 'block';
|
1114
1114
|
}
|
1115
1115
|
}
|
1116
1116
|
|
1117
1117
|
function setThreshold() {
|
1118
1118
|
var tv = document.getElementById("threshold").value;
|
1119
1119
|
if (tv.match(/[0-9]+([.,][0-9]+)?/)) {
|
1120
|
-
var f = parseFloat(tv.replace(/,/,
|
1120
|
+
var f = parseFloat(tv.replace(/,/, '.'));
|
1121
1121
|
var threads = document.getElementsByName("thread");
|
1122
1122
|
var l = threads.length;
|
1123
1123
|
for ( var i = 0; i < l ; i++ ) {
|
1124
1124
|
setThresholdUL(threads[i], f);
|
1125
1125
|
}
|
1126
1126
|
var p = selectedNode;
|
1127
|
-
while (p && p.style.display
|
1127
|
+
while (p && p.style.display=='none')
|
1128
1128
|
p=p.parentNode.parentNode;
|
1129
1129
|
if (p && p.nodeName=="LI")
|
1130
1130
|
selectNode(p);
|
@@ -1157,11 +1157,11 @@ function toggleHelp(node) {
|
|
1157
1157
|
var help = document.getElementById("help");
|
1158
1158
|
if (node.value == "Show Help") {
|
1159
1159
|
node.value = "Hide Help";
|
1160
|
-
help.style.display =
|
1160
|
+
help.style.display = 'block';
|
1161
1161
|
}
|
1162
1162
|
else {
|
1163
1163
|
node.value = "Show Help";
|
1164
|
-
help.style.display =
|
1164
|
+
help.style.display = 'none';
|
1165
1165
|
}
|
1166
1166
|
}
|
1167
1167
|
|
@@ -1198,7 +1198,7 @@ function selectNode(node, event) {
|
|
1198
1198
|
|
1199
1199
|
function moveUp(){
|
1200
1200
|
var p = selectedNode.previousSibling;
|
1201
|
-
while (p && p.style.display ==
|
1201
|
+
while (p && p.style.display == 'none')
|
1202
1202
|
p = p.previousSibling;
|
1203
1203
|
if (p && p.nodeName == "LI") {
|
1204
1204
|
selectNode(p, null);
|
@@ -1207,7 +1207,7 @@ function moveUp(){
|
|
1207
1207
|
|
1208
1208
|
function moveDown(){
|
1209
1209
|
var p = selectedNode.nextSibling;
|
1210
|
-
while (p && p.style.display ==
|
1210
|
+
while (p && p.style.display == 'none')
|
1211
1211
|
p = p.nextSibling;
|
1212
1212
|
if (p && p.nodeName == "LI") {
|
1213
1213
|
selectNode(p, null);
|
@@ -1234,7 +1234,7 @@ function moveRight(){
|
|
1234
1234
|
function moveForward(){
|
1235
1235
|
if (isLeafNode(selectedNode)) {
|
1236
1236
|
var p = selectedNode;
|
1237
|
-
while ((p.nextSibling == null || p.nextSibling.style.display
|
1237
|
+
while ((p.nextSibling == null || p.nextSibling.style.display=='none') && p.nodeName=="LI") {
|
1238
1238
|
p = p.parentNode.parentNode;
|
1239
1239
|
}
|
1240
1240
|
if (p.nodeName=="LI")
|
@@ -1247,20 +1247,20 @@ function moveForward(){
|
|
1247
1247
|
|
1248
1248
|
function isExpandedNode(li){
|
1249
1249
|
var img = li.firstChild;
|
1250
|
-
return(img.src.indexOf(
|
1250
|
+
return(img.src.indexOf('minus.png')>-1);
|
1251
1251
|
}
|
1252
1252
|
|
1253
1253
|
function moveBackward(){
|
1254
1254
|
var p = selectedNode;
|
1255
1255
|
var q = p.previousSibling;
|
1256
|
-
while (q != null && q.style.display
|
1256
|
+
while (q != null && q.style.display=='none')
|
1257
1257
|
q = q.previousSibling;
|
1258
1258
|
if (q == null) {
|
1259
1259
|
p = p.parentNode.parentNode;
|
1260
1260
|
} else {
|
1261
1261
|
while (!isLeafNode(q) && isExpandedNode(q)) {
|
1262
1262
|
q = findUlChild(q).lastChild;
|
1263
|
-
while (q.style.display
|
1263
|
+
while (q.style.display=='none')
|
1264
1264
|
q = q.previousSibling;
|
1265
1265
|
}
|
1266
1266
|
p = q;
|
@@ -1412,7 +1412,7 @@ window.onload=function(){
|
|
1412
1412
|
<span class="ruby-keyword">if</span> <span class="ruby-identifier">expanded</span>
|
1413
1413
|
<span class="ruby-ivar">@output</span>.<span class="ruby-identifier">print</span> <span class="ruby-string">"<ul>"</span>
|
1414
1414
|
<span class="ruby-keyword">else</span>
|
1415
|
-
<span class="ruby-ivar">@output</span>.<span class="ruby-identifier">print</span> <span class="ruby-string"
|
1415
|
+
<span class="ruby-ivar">@output</span>.<span class="ruby-identifier">print</span> <span class="ruby-string">'<ul style="display:none">'</span>
|
1416
1416
|
<span class="ruby-keyword">end</span>
|
1417
1417
|
<span class="ruby-identifier">kids</span>.<span class="ruby-identifier">sort_by</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span> <span class="ruby-operator">-</span><span class="ruby-identifier">c</span>.<span class="ruby-identifier">total_time</span>}.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">callinfo</span><span class="ruby-operator">|</span>
|
1418
1418
|
<span class="ruby-identifier">print_stack</span> <span class="ruby-identifier">callinfo</span>, <span class="ruby-identifier">total_time</span>
|