ruby-prof 0.15.6 → 0.15.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2611a288f51e3e7d0a29f25930cefe6420b4a01e
4
- data.tar.gz: a8cdc8375d6bfd6ba5455f87f8be3c8b438a387b
3
+ metadata.gz: f31f6335c5b4bc25d847941cf578a08229c46051
4
+ data.tar.gz: c9f39f86d5d093e753e2a00d4cdf30244d025f1f
5
5
  SHA512:
6
- metadata.gz: f8a15d1854ee6028cd5f549a6376a1c48468e05d4f6dac0f5cd13209d88fd7fc0eab30fde4798a9e1f982c5e1bc0fd73145937e93265d4c0839731e8c53b46d2
7
- data.tar.gz: bd0385167c33165e05a09d0a5f71b02fc4ecdf64290fbfded52c4df7de0ce71d786af7da4211bf38814ea3d801981f608be3a1b64fa49a702d83bedacbeb35ed
6
+ metadata.gz: 2209b4b9767c7e197c38d07aab82f8f571f17704a248d5b4fb86d1c40499ed0608b2930e6e6ec9f027ef239ce9a5a956481f9438d9de66d630564ed763ec9d90
7
+ data.tar.gz: cf1ad769cee4fbc27afacfea9344dfda52ee3837cd1cbb6491f60e387b1b9fa98cd2c60ac8cebed078b51f0ee49ec7e14863096a0767641578a2c83a56ac1572
data/CHANGES CHANGED
@@ -1,3 +1,7 @@
1
+ 0.15.7 (2015-04-23)
2
+ ======================
3
+ * html profiles are now single page (thx to Thomas Leishman)
4
+
1
5
  0.15.6 (2015-02-22)
2
6
  ======================
3
7
  * improved upon computing children time in graph printers
data/README.rdoc CHANGED
@@ -16,7 +16,11 @@ ruby-prof is a fast code profiler for Ruby. Its features include:
16
16
 
17
17
  == Requirements
18
18
 
19
- ruby-prof requires Ruby 1.9.3 or higher.
19
+ ruby-prof requires Ruby 1.9.3 or higher. Please note some ruby
20
+ releases have known bugs which cause ruby-prof problems, like
21
+ incorrect measurements. We suggest to use the latest minor patch level
22
+ release if possible. In particular, on the 2.1 branch of ruby you
23
+ should use 2.1.5.
20
24
 
21
25
  If you are running Linux or Unix you'll need a C compiler so the extension
22
26
  can be compiled when it is installed.
@@ -143,16 +147,16 @@ If you want to get a more accurate measurement of what takes all of a gem's bin/
143
147
  command to load, you may want to also measure rubygems' startup penalty.
144
148
  You can do this by calling into bin/ruby-prof directly, ex:
145
149
 
146
- $ gem which ruby-prof
150
+ $ gem which ruby-prof
147
151
  g:/192/lib/ruby/gems/1.9.1/gems/ruby-prof-0.10.2/lib/ruby-prof.rb
148
152
 
149
153
  now run it thus (substitute lib/ruby-prof.rb with bin/ruby-prof):
150
154
 
151
- $ ruby g:/192/lib/ruby/gems/1.9.1/gems/ruby-prof-0.10.2/bin/ruby-prof g:\192\bin\some_installed_gem_command
155
+ $ ruby g:/192/lib/ruby/gems/1.9.1/gems/ruby-prof-0.10.2/bin/ruby-prof g:\192\bin\some_installed_gem_command
152
156
 
153
157
  or
154
158
 
155
- $ ruby g:/192/lib/ruby/gems/1.9.1/gems/ruby-prof-0.10.2/bin/ruby-prof ./some_file_that_does_a_require_rubygems_at_the_beginning.rb
159
+ $ ruby g:/192/lib/ruby/gems/1.9.1/gems/ruby-prof-0.10.2/bin/ruby-prof ./some_file_that_does_a_require_rubygems_at_the_beginning.rb
156
160
 
157
161
 
158
162
  == Profiling Rails
data/doc/README_rdoc.html CHANGED
@@ -136,7 +136,10 @@ href="README_rdoc.html">README</a>.</p>
136
136
 
137
137
  <h2 id="label-Requirements">Requirements<span><a href="#label-Requirements">&para;</a> <a href="#top">&uarr;</a></span></h2>
138
138
 
139
- <p>ruby-prof requires Ruby 1.9.3 or higher.</p>
139
+ <p>ruby-prof requires Ruby 1.9.3 or higher. Please note some ruby releases
140
+ have known bugs which cause ruby-prof problems, like incorrect
141
+ measurements. We suggest to use the latest minor patch level release if
142
+ possible. In particular, on the 2.1 branch of ruby you should use 2.1.5.</p>
140
143
 
141
144
  <p>If you are running Linux or Unix you&#39;ll need a C compiler so the
142
145
  extension can be compiled when it is installed.</p>
@@ -270,19 +273,16 @@ gem&#39;s bin/xxx command to load, you may want to also measure
270
273
  rubygems&#39; startup penalty. You can do this by calling into
271
274
  bin/ruby-prof directly, ex:</p>
272
275
 
273
- <p>$ gem which ruby-prof</p>
274
-
275
- <pre>g:/192/lib/ruby/gems/1.9.1/gems/ruby-prof-0.10.2/lib/ruby-prof.rb</pre>
276
+ <pre>$ gem which ruby-prof
277
+ g:/192/lib/ruby/gems/1.9.1/gems/ruby-prof-0.10.2/lib/ruby-prof.rb</pre>
276
278
 
277
279
  <p>now run it thus (substitute lib/ruby-prof.rb with bin/ruby-prof):</p>
278
280
 
279
- <p>$ ruby g:/192/lib/ruby/gems/1.9.1/gems/ruby-prof-0.10.2/bin/ruby-prof
280
- g:192binsome_installed_gem_command</p>
281
+ <pre>$ ruby g:/192/lib/ruby/gems/1.9.1/gems/ruby-prof-0.10.2/bin/ruby-prof g:\192\bin\some_installed_gem_command</pre>
281
282
 
282
283
  <p>or</p>
283
284
 
284
- <p>$ ruby g:/192/lib/ruby/gems/1.9.1/gems/ruby-prof-0.10.2/bin/ruby-prof
285
- ./some_file_that_does_a_require_rubygems_at_the_beginning.rb</p>
285
+ <pre>$ ruby g:/192/lib/ruby/gems/1.9.1/gems/ruby-prof-0.10.2/bin/ruby-prof ./some_file_that_does_a_require_rubygems_at_the_beginning.rb</pre>
286
286
 
287
287
  <h2 id="label-Profiling+Rails">Profiling Rails<span><a href="#label-Profiling+Rails">&para;</a> <a href="#top">&uarr;</a></span></h2>
288
288
 
@@ -85,9 +85,9 @@
85
85
 
86
86
  <li ><a href="#method-i-arguments">#arguments</a>
87
87
 
88
- <li ><a href="#method-i-color">#color</a>
88
+ <li ><a href="#method-i-base64_image">#base64_image</a>
89
89
 
90
- <li ><a href="#method-i-copy_image_files">#copy_image_files</a>
90
+ <li ><a href="#method-i-color">#color</a>
91
91
 
92
92
  <li ><a href="#method-i-dump">#dump</a>
93
93
 
@@ -101,6 +101,8 @@
101
101
 
102
102
  <li ><a href="#method-i-name">#name</a>
103
103
 
104
+ <li ><a href="#method-i-open_asset">#open_asset</a>
105
+
104
106
  <li ><a href="#method-i-print">#print</a>
105
107
 
106
108
  <li ><a href="#method-i-print_commands">#print_commands</a>
@@ -229,11 +231,11 @@
229
231
  </div>
230
232
 
231
233
 
232
- <div id="method-i-color" class="method-detail ">
234
+ <div id="method-i-base64_image" class="method-detail ">
233
235
 
234
236
  <div class="method-heading">
235
- <span class="method-name">color</span><span
236
- class="method-args">(p)</span>
237
+ <span class="method-name">base64_image</span><span
238
+ class="method-args">()</span>
237
239
 
238
240
  <span class="method-click-advice">click to toggle source</span>
239
241
 
@@ -247,19 +249,11 @@
247
249
 
248
250
 
249
251
 
250
- <div class="method-source-code" id="color-source">
251
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 149</span>
252
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">color</span>(<span class="ruby-identifier">p</span>)
253
- <span class="ruby-keyword">case</span> <span class="ruby-identifier">i</span> = <span class="ruby-identifier">p</span>.<span class="ruby-identifier">to_i</span>
254
- <span class="ruby-keyword">when</span> <span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-value">5</span>
255
- <span class="ruby-string">&quot;01&quot;</span>
256
- <span class="ruby-keyword">when</span> <span class="ruby-value">5</span><span class="ruby-operator">..</span><span class="ruby-value">10</span>
257
- <span class="ruby-string">&quot;05&quot;</span>
258
- <span class="ruby-keyword">when</span> <span class="ruby-value">100</span>
259
- <span class="ruby-string">&quot;9&quot;</span>
260
- <span class="ruby-keyword">else</span>
261
- <span class="ruby-node">&quot;#{i/10}&quot;</span>
262
- <span class="ruby-keyword">end</span>
252
+ <div class="method-source-code" id="base64_image-source">
253
+ <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 208</span>
254
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">base64_image</span>
255
+ <span class="ruby-identifier">file</span> = <span class="ruby-identifier">open_asset</span>(<span class="ruby-string">&#39;call_stack_printer.png&#39;</span>)
256
+ <span class="ruby-constant">Base64</span>.<span class="ruby-identifier">encode64</span>(<span class="ruby-identifier">file</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp">/\n/</span>, <span class="ruby-string">&#39;&#39;</span>)
263
257
  <span class="ruby-keyword">end</span></pre>
264
258
  </div>
265
259
 
@@ -271,11 +265,11 @@
271
265
  </div>
272
266
 
273
267
 
274
- <div id="method-i-copy_image_files" class="method-detail ">
268
+ <div id="method-i-color" class="method-detail ">
275
269
 
276
270
  <div class="method-heading">
277
- <span class="method-name">copy_image_files</span><span
278
- class="method-args">()</span>
271
+ <span class="method-name">color</span><span
272
+ class="method-args">(p)</span>
279
273
 
280
274
  <span class="method-click-advice">click to toggle source</span>
281
275
 
@@ -289,17 +283,18 @@
289
283
 
290
284
 
291
285
 
292
- <div class="method-source-code" id="copy_image_files-source">
293
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 182</span>
294
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">copy_image_files</span>
295
- <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>)
296
- <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>)
297
- <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">&#39;..&#39;</span>, <span class="ruby-string">&#39;images&#39;</span>)
298
- <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>
299
- <span class="ruby-identifier">source_file</span> = <span class="ruby-node">&quot;#{image_dir}/#{img}.png&quot;</span>
300
- <span class="ruby-identifier">target_file</span> = <span class="ruby-node">&quot;#{target_dir}/#{img}.png&quot;</span>
301
- <span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">cp</span>(<span class="ruby-identifier">source_file</span>, <span class="ruby-identifier">target_file</span>) <span class="ruby-keyword">unless</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">target_file</span>)
302
- <span class="ruby-keyword">end</span>
286
+ <div class="method-source-code" id="color-source">
287
+ <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 149</span>
288
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">color</span>(<span class="ruby-identifier">p</span>)
289
+ <span class="ruby-keyword">case</span> <span class="ruby-identifier">i</span> = <span class="ruby-identifier">p</span>.<span class="ruby-identifier">to_i</span>
290
+ <span class="ruby-keyword">when</span> <span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-value">5</span>
291
+ <span class="ruby-string">&quot;01&quot;</span>
292
+ <span class="ruby-keyword">when</span> <span class="ruby-value">5</span><span class="ruby-operator">..</span><span class="ruby-value">10</span>
293
+ <span class="ruby-string">&quot;05&quot;</span>
294
+ <span class="ruby-keyword">when</span> <span class="ruby-value">100</span>
295
+ <span class="ruby-string">&quot;9&quot;</span>
296
+ <span class="ruby-keyword">else</span>
297
+ <span class="ruby-node">&quot;#{i/10}&quot;</span>
303
298
  <span class="ruby-keyword">end</span>
304
299
  <span class="ruby-keyword">end</span></pre>
305
300
  </div>
@@ -521,6 +516,40 @@
521
516
 
522
517
 
523
518
 
519
+ </div>
520
+
521
+
522
+ <div id="method-i-open_asset" class="method-detail ">
523
+
524
+ <div class="method-heading">
525
+ <span class="method-name">open_asset</span><span
526
+ class="method-args">(file)</span>
527
+
528
+ <span class="method-click-advice">click to toggle source</span>
529
+
530
+ </div>
531
+
532
+
533
+ <div class="method-description">
534
+
535
+
536
+
537
+
538
+
539
+
540
+ <div class="method-source-code" id="open_asset-source">
541
+ <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 198</span>
542
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">open_asset</span>(<span class="ruby-identifier">file</span>)
543
+ <span class="ruby-identifier">path</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-string">&#39;../../assets&#39;</span>, <span class="ruby-keyword">__FILE__</span>), <span class="ruby-identifier">file</span>)
544
+ <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">path</span>, <span class="ruby-string">&#39;rb&#39;</span>).<span class="ruby-identifier">read</span>
545
+ <span class="ruby-keyword">end</span></pre>
546
+ </div>
547
+
548
+ </div>
549
+
550
+
551
+
552
+
524
553
  </div>
525
554
 
526
555
 
@@ -569,7 +598,7 @@
569
598
 
570
599
 
571
600
  <div class="method-source-code" id="print-source">
572
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 37</span>
601
+ <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 38</span>
573
602
  <span class="ruby-keyword">def</span> <span class="ruby-identifier">print</span>(<span class="ruby-identifier">output</span> = <span class="ruby-constant">STDOUT</span>, <span class="ruby-identifier">options</span> = {})
574
603
  <span class="ruby-ivar">@output</span> = <span class="ruby-identifier">output</span>
575
604
  <span class="ruby-identifier">setup_options</span>(<span class="ruby-identifier">options</span>)
@@ -604,7 +633,6 @@
604
633
 
605
634
  <span class="ruby-identifier">print_footer</span>
606
635
 
607
- <span class="ruby-identifier">copy_image_files</span>
608
636
  <span class="ruby-keyword">end</span></pre>
609
637
  </div>
610
638
 
@@ -635,7 +663,7 @@
635
663
 
636
664
 
637
665
  <div class="method-source-code" id="print_commands-source">
638
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 740</span>
666
+ <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 227</span>
639
667
  <span class="ruby-keyword">def</span> <span class="ruby-identifier">print_commands</span>
640
668
  <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">puts</span> <span class="ruby-value">&lt;&lt;-&quot;end_commands&quot;
641
669
  &lt;div id=\&quot;commands\&quot;&gt;
@@ -677,111 +705,11 @@ end_commands</span>
677
705
 
678
706
 
679
707
  <div class="method-source-code" id="print_css-source">
680
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 210</span>
681
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">print_css</span>
682
- <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">puts</span> <span class="ruby-value">&lt;&lt;-&#39;end_css&#39;
683
- &lt;style type=&quot;text/css&quot;&gt;
684
- &lt;!--
685
- body {
686
- font-size:70%;
687
- padding:0px;
688
- margin:5px;
689
- margin-right:0px;
690
- margin-left:0px;
691
- background: #ffffff;
692
- }
693
- ul {
694
- margin-left:0px;
695
- margin-top:0px;
696
- margin-bottom:0px;
697
- padding-left:0px;
698
- list-style-type:none;
699
- }
700
- li {
701
- margin-left:11px;
702
- padding:0px;
703
- white-space:nowrap;
704
- border-top:1px solid #cccccc;
705
- border-left:1px solid #cccccc;
706
- border-bottom:none;
707
- }
708
- .thread {
709
- margin-left:11px;
710
- background:#708090;
711
- padding-top:3px;
712
- padding-left:12px;
713
- padding-bottom:2px;
714
- border-left:1px solid #CCCCCC;
715
- border-top:1px solid #CCCCCC;
716
- font-weight:bold;
717
- }
718
- .hidden {
719
- display:none;
720
- width:0px;
721
- height:0px;
722
- margin:0px;
723
- padding:0px;
724
- border-style:none;
725
- }
726
- .color01 { background:#adbdeb }
727
- .color05 { background:#9daddb }
728
- .color0 { background:#8d9dcb }
729
- .color1 { background:#89bccb }
730
- .color2 { background:#56e3e7 }
731
- .color3 { background:#32cd70 }
732
- .color4 { background:#a3d53c }
733
- .color5 { background:#c4cb34 }
734
- .color6 { background:#dcb66d }
735
- .color7 { background:#cda59e }
736
- .color8 { background:#be9d9c }
737
- .color9 { background:#cf947a }
738
- #commands {
739
- font-size:10pt;
740
- padding:10px;
741
- margin-left:11px;
742
- margin-bottom:0px;
743
- margin-top:0px;
744
- background:#708090;
745
- border-top:1px solid #cccccc;
746
- border-left:1px solid #cccccc;
747
- border-bottom:none;
748
- }
749
- #titlebar {
750
- font-size:10pt;
751
- padding:10px;
752
- margin-left:11px;
753
- margin-bottom:0px;
754
- margin-top:10px;
755
- background:#8090a0;
756
- border-top:1px solid #cccccc;
757
- border-left:1px solid #cccccc;
758
- border-bottom:none;
759
- }
760
- #help {
761
- font-size:10pt;
762
- padding:10px;
763
- margin-left:11px;
764
- margin-bottom:0px;
765
- margin-top:0px;
766
- background:#8090a0;
767
- display:none;
768
- border-top:1px solid #cccccc;
769
- border-left:1px solid #cccccc;
770
- border-bottom:none;
771
- }
772
- #sentinel {
773
- height: 400px;
774
- margin-left:11px;
775
- background:#8090a0;
776
- border-top:1px solid #cccccc;
777
- border-left:1px solid #cccccc;
778
- border-bottom:none;
779
- }
780
- input { margin-left:10px; }
781
- --&gt;
782
- &lt;/style&gt;
783
- end_css</span>
784
- <span class="ruby-keyword">end</span></pre>
708
+ <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 203</span>
709
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">print_css</span>
710
+ <span class="ruby-identifier">html</span> = <span class="ruby-identifier">open_asset</span>(<span class="ruby-string">&#39;call_stack_printer.css.html&#39;</span>)
711
+ <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">puts</span> <span class="ruby-identifier">html</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-string">&#39;%s&#39;</span>, <span class="ruby-identifier">base64_image</span>)
712
+ <span class="ruby-keyword">end</span></pre>
785
713
  </div>
786
714
 
787
715
  </div>
@@ -811,7 +739,7 @@ end_css</span>
811
739
 
812
740
 
813
741
  <div class="method-source-code" id="print_footer-source">
814
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 206</span>
742
+ <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 194</span>
815
743
  <span class="ruby-keyword">def</span> <span class="ruby-identifier">print_footer</span>
816
744
  <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">puts</span> <span class="ruby-string">&#39;&lt;div id=&quot;sentinel&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/body&gt;&lt;/html&gt;&#39;</span>
817
745
  <span class="ruby-keyword">end</span></pre>
@@ -844,7 +772,7 @@ end_css</span>
844
772
 
845
773
 
846
774
  <div class="method-source-code" id="print_header-source">
847
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 194</span>
775
+ <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 182</span>
848
776
  <span class="ruby-keyword">def</span> <span class="ruby-identifier">print_header</span>
849
777
  <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">puts</span> <span class="ruby-string">&quot;&lt;html&gt;&lt;head&gt;&quot;</span>
850
778
  <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">puts</span> <span class="ruby-string">&#39;&lt;meta http-equiv=&quot;content-type&quot; content=&quot;text/html; charset=utf-8&quot;&gt;&#39;</span>
@@ -885,21 +813,21 @@ end_css</span>
885
813
 
886
814
 
887
815
  <div class="method-source-code" id="print_help-source">
888
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 753</span>
816
+ <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 240</span>
889
817
  <span class="ruby-keyword">def</span> <span class="ruby-identifier">print_help</span>
890
818
  <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">puts</span> <span class="ruby-value">&lt;&lt;-&#39;end_help&#39;
891
819
  &lt;div style=&quot;display: none;&quot; id=&quot;help&quot;&gt;
892
- &lt;img src=&quot;empty.png&quot;&gt; Enter a decimal value &lt;i&gt;d&lt;/i&gt; into the threshold field and click &quot;Apply&quot;
893
- to hide all nodes marked with time values lower than &lt;i&gt;d&lt;/i&gt;.&lt;br&gt;
894
- &lt;img src=&quot;empty.png&quot;&gt; Click on &quot;Expand All&quot; for full tree expansion.&lt;br&gt;
895
- &lt;img src=&quot;empty.png&quot;&gt; Click on &quot;Collapse All&quot; to show only top level nodes.&lt;br&gt;
896
- &lt;img src=&quot;empty.png&quot;&gt; Use a, s, d, w as in Quake or Urban Terror to navigate the tree.&lt;br&gt;
897
- &lt;img src=&quot;empty.png&quot;&gt; Use f and b to navigate the tree in preorder forward and backwards.&lt;br&gt;
898
- &lt;img src=&quot;empty.png&quot;&gt; Use x to toggle visibility of a subtree.&lt;br&gt;
899
- &lt;img src=&quot;empty.png&quot;&gt; Use * to expand/collapse a whole subtree.&lt;br&gt;
900
- &lt;img src=&quot;empty.png&quot;&gt; Use h to navigate to thread root.&lt;br&gt;
901
- &lt;img src=&quot;empty.png&quot;&gt; Use n and p to navigate between threads.&lt;br&gt;
902
- &lt;img src=&quot;empty.png&quot;&gt; Click on background to move focus to a subtree.&lt;br&gt;
820
+ &amp;#8226; Enter a decimal value &lt;i&gt;d&lt;/i&gt; into the threshold field and click &quot;Apply&quot;
821
+ to hide all nodes marked with time values lower than &lt;i&gt;d&lt;/i&gt;.&lt;br&gt;
822
+ &amp;#8226; Click on &quot;Expand All&quot; for full tree expansion.&lt;br&gt;
823
+ &amp;#8226; Click on &quot;Collapse All&quot; to show only top level nodes.&lt;br&gt;
824
+ &amp;#8226; Use a, s, d, w as in Quake or Urban Terror to navigate the tree.&lt;br&gt;
825
+ &amp;#8226; Use f and b to navigate the tree in preorder forward and backwards.&lt;br&gt;
826
+ &amp;#8226; Use x to toggle visibility of a subtree.&lt;br&gt;
827
+ &amp;#8226; Use * to expand/collapse a whole subtree.&lt;br&gt;
828
+ &amp;#8226; Use h to navigate to thread root.&lt;br&gt;
829
+ &amp;#8226; Use n and p to navigate between threads.&lt;br&gt;
830
+ &amp;#8226; Click on background to move focus to a subtree.&lt;br&gt;
903
831
  &lt;/div&gt;
904
832
  end_help</span>
905
833
  <span class="ruby-keyword">end</span></pre>
@@ -932,422 +860,11 @@ end_help</span>
932
860
 
933
861
 
934
862
  <div class="method-source-code" id="print_java_script-source">
935
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 315</span>
936
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">print_java_script</span>
937
- <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">puts</span> <span class="ruby-value">&lt;&lt;-&#39;end_java_script&#39;
938
- &lt;script type=&quot;text/javascript&quot;&gt;
939
- /*
940
- Copyright (C) 2005,2009 Stefan Kaes
941
- skaes@railsexpress.de
942
- */
943
-
944
- function rootNode() {
945
- return currentThread;
946
- }
947
-
948
- function hideUL(node) {
949
- var lis = node.childNodes
950
- var l = lis.length;
951
- for (var i=0; i &lt; l ; i++ ) {
952
- hideLI(lis[i]);
953
- }
954
- }
955
-
956
- function showUL(node) {
957
- var lis = node.childNodes;
958
- var l = lis.length;
959
- for (var i=0; i &lt; l ; i++ ) {
960
- showLI(lis[i]);
961
- }
962
- }
963
-
964
- function findUlChild(li){
965
- var ul = li.childNodes[2];
966
- while (ul &amp;&amp; ul.nodeName != &quot;UL&quot;) {
967
- ul = ul.nextSibling;
968
- }
969
- return ul;
970
- }
971
-
972
- function isLeafNode(li) {
973
- var img = li.firstChild;
974
- return (img.src.indexOf(&#39;empty.png&#39;) &gt; -1);
975
- }
976
-
977
- function hideLI(li) {
978
- if (isLeafNode(li))
979
- return;
980
-
981
- var img = li.firstChild;
982
- img.src = &#39;plus.png&#39;;
983
-
984
- var ul = findUlChild(li);
985
- if (ul) {
986
- ul.style.display = &#39;none&#39;;
987
- hideUL(ul);
988
- }
989
- }
990
-
991
- function showLI(li) {
992
- if (isLeafNode(li))
993
- return;
994
-
995
- var img = li.firstChild;
996
- img.src = &#39;minus.png&#39;;
997
-
998
- var ul = findUlChild(li);
999
- if (ul) {
1000
- ul.style.display = &#39;block&#39;;
1001
- showUL(ul);
1002
- }
1003
- }
1004
-
1005
- function toggleLI(li) {
1006
- var img = li.firstChild;
1007
- if (img.src.indexOf(&quot;minus.png&quot;)&gt;-1)
1008
- hideLI(li);
1009
- else {
1010
- if (img.src.indexOf(&quot;plus.png&quot;)&gt;-1)
1011
- showLI(li);
1012
- }
1013
- }
1014
-
1015
- function aboveThreshold(text, threshold) {
1016
- var match = text.match(/\d+[.,]\d+/);
1017
- return (match &amp;&amp; parseFloat(match[0].replace(/,/, &#39;.&#39;))&gt;=threshold);
1018
- }
1019
-
1020
- function setThresholdLI(li, threshold) {
1021
- var img = li.firstChild;
1022
- var text = img.nextSibling;
1023
- var ul = findUlChild(li);
1024
-
1025
- var visible = aboveThreshold(text.nodeValue, threshold) ? 1 : 0;
1026
-
1027
- var count = 0;
1028
- if (ul) {
1029
- count = setThresholdUL(ul, threshold);
1030
- }
1031
- if (count&gt;0) {
1032
- img.src = &#39;minus.png&#39;;
1033
- }
1034
- else {
1035
- img.src = &#39;empty.png&#39;;
1036
- }
1037
- if (visible) {
1038
- li.style.display = &#39;block&#39;
1039
- }
1040
- else {
1041
- li.style.display = &#39;none&#39;
1042
- }
1043
- return visible;
1044
- }
1045
-
1046
- function setThresholdUL(node, threshold) {
1047
- var lis = node.childNodes;
1048
- var l = lis.length;
1049
-
1050
- var count = 0;
1051
- for ( var i = 0; i &lt; l ; i++ ) {
1052
- count = count + setThresholdLI(lis[i], threshold);
1053
- }
1054
-
1055
- var visible = (count &gt; 0) ? 1 : 0;
1056
- if (visible) {
1057
- node.style.display = &#39;block&#39;;
1058
- }
1059
- else {
1060
- node.style.display = &#39;none&#39;;
1061
- }
1062
- return visible;
1063
- }
1064
-
1065
- function toggleChildren(img, event) {
1066
- event.cancelBubble=true;
1067
-
1068
- if (img.src.indexOf(&#39;empty.png&#39;) &gt; -1)
1069
- return;
1070
-
1071
- var minus = (img.src.indexOf(&#39;minus.png&#39;) &gt; -1);
1072
-
1073
- if (minus) {
1074
- img.src = &#39;plus.png&#39;;
1075
- }
1076
- else
1077
- img.src = &#39;minus.png&#39;;
1078
-
1079
- var li = img.parentNode;
1080
- var ul = findUlChild(li);
1081
- if (ul) {
1082
- if (minus)
1083
- ul.style.display = &#39;none&#39;;
1084
- else
1085
- ul.style.display = &#39;block&#39;;
1086
- }
1087
- if (minus)
1088
- moveSelectionIfNecessary(li);
1089
- }
1090
-
1091
- function showChildren(li) {
1092
- var img = li.firstChild;
1093
- if (img.src.indexOf(&#39;empty.png&#39;) &gt; -1)
1094
- return;
1095
- img.src = &#39;minus.png&#39;;
1096
-
1097
- var ul = findUlChild(li);
1098
- if (ul) {
1099
- ul.style.display = &#39;block&#39;;
1100
- }
1101
- }
1102
-
1103
- function setThreshold() {
1104
- var tv = document.getElementById(&quot;threshold&quot;).value;
1105
- if (tv.match(/[0-9]+([.,][0-9]+)?/)) {
1106
- var f = parseFloat(tv.replace(/,/, &#39;.&#39;));
1107
- var threads = document.getElementsByName(&quot;thread&quot;);
1108
- var l = threads.length;
1109
- for ( var i = 0; i &lt; l ; i++ ) {
1110
- setThresholdUL(threads[i], f);
1111
- }
1112
- var p = selectedNode;
1113
- while (p &amp;&amp; p.style.display==&#39;none&#39;)
1114
- p=p.parentNode.parentNode;
1115
- if (p &amp;&amp; p.nodeName==&quot;LI&quot;)
1116
- selectNode(p);
1117
- }
1118
- else {
1119
- alert(&quot;Please specify a decimal number as threshold value!&quot;);
1120
- }
1121
- }
1122
-
1123
- function collapseAll(event) {
1124
- event.cancelBubble=true;
1125
- var threads = document.getElementsByName(&quot;thread&quot;);
1126
- var l = threads.length;
1127
- for ( var i = 0; i &lt; l ; i++ ) {
1128
- hideUL(threads[i]);
1129
- }
1130
- selectNode(rootNode(), null);
1131
- }
1132
-
1133
- function expandAll(event) {
1134
- event.cancelBubble=true;
1135
- var threads = document.getElementsByName(&quot;thread&quot;);
1136
- var l = threads.length;
1137
- for ( var i = 0; i &lt; l ; i++ ) {
1138
- showUL(threads[i]);
1139
- }
1140
- }
1141
-
1142
- function toggleHelp(node) {
1143
- var help = document.getElementById(&quot;help&quot;);
1144
- if (node.value == &quot;Show Help&quot;) {
1145
- node.value = &quot;Hide Help&quot;;
1146
- help.style.display = &#39;block&#39;;
1147
- }
1148
- else {
1149
- node.value = &quot;Show Help&quot;;
1150
- help.style.display = &#39;none&#39;;
1151
- }
1152
- }
1153
-
1154
- var selectedNode = null;
1155
- var selectedColor = null;
1156
- var selectedThread = null;
1157
-
1158
- function descendentOf(a,b){
1159
- while (a!=b &amp;&amp; b!=null)
1160
- b=b.parentNode;
1161
- return (a==b);
1162
- }
1163
-
1164
- function moveSelectionIfNecessary(node){
1165
- if (descendentOf(node, selectedNode))
1166
- selectNode(node, null);
1167
- }
1168
-
1169
- function selectNode(node, event) {
1170
- if (event) {
1171
- event.cancelBubble = true;
1172
- thread = findThread(node);
1173
- selectThread(thread);
1174
- }
1175
- if (selectedNode) {
1176
- selectedNode.style.background = selectedColor;
1177
- }
1178
- selectedNode = node;
1179
- selectedColor = node.style.background;
1180
- selectedNode.style.background = &quot;red&quot;;
1181
- selectedNode.scrollIntoView();
1182
- window.scrollBy(0,-400);
1183
- }
1184
-
1185
- function moveUp(){
1186
- var p = selectedNode.previousSibling;
1187
- while (p &amp;&amp; p.style.display == &#39;none&#39;)
1188
- p = p.previousSibling;
1189
- if (p &amp;&amp; p.nodeName == &quot;LI&quot;) {
1190
- selectNode(p, null);
1191
- }
1192
- }
1193
-
1194
- function moveDown(){
1195
- var p = selectedNode.nextSibling;
1196
- while (p &amp;&amp; p.style.display == &#39;none&#39;)
1197
- p = p.nextSibling;
1198
- if (p &amp;&amp; p.nodeName == &quot;LI&quot;) {
1199
- selectNode(p, null);
1200
- }
1201
- }
1202
-
1203
- function moveLeft(){
1204
- var p = selectedNode.parentNode.parentNode;
1205
- if (p &amp;&amp; p.nodeName==&quot;LI&quot;) {
1206
- selectNode(p, null);
1207
- }
1208
- }
1209
-
1210
- function moveRight(){
1211
- if (!isLeafNode(selectedNode)) {
1212
- showChildren(selectedNode);
1213
- var ul = findUlChild(selectedNode);
1214
- if (ul) {
1215
- selectNode(ul.firstChild, null);
1216
- }
1217
- }
1218
- }
1219
-
1220
- function moveForward(){
1221
- if (isLeafNode(selectedNode)) {
1222
- var p = selectedNode;
1223
- while ((p.nextSibling == null || p.nextSibling.style.display==&#39;none&#39;) &amp;&amp; p.nodeName==&quot;LI&quot;) {
1224
- p = p.parentNode.parentNode;
1225
- }
1226
- if (p.nodeName==&quot;LI&quot;)
1227
- selectNode(p.nextSibling, null);
1228
- }
1229
- else {
1230
- moveRight();
1231
- }
1232
- }
1233
-
1234
- function isExpandedNode(li){
1235
- var img = li.firstChild;
1236
- return(img.src.indexOf(&#39;minus.png&#39;)&gt;-1);
1237
- }
1238
-
1239
- function moveBackward(){
1240
- var p = selectedNode;
1241
- var q = p.previousSibling;
1242
- while (q != null &amp;&amp; q.style.display==&#39;none&#39;)
1243
- q = q.previousSibling;
1244
- if (q == null) {
1245
- p = p.parentNode.parentNode;
1246
- } else {
1247
- while (!isLeafNode(q) &amp;&amp; isExpandedNode(q)) {
1248
- q = findUlChild(q).lastChild;
1249
- while (q.style.display==&#39;none&#39;)
1250
- q = q.previousSibling;
1251
- }
1252
- p = q;
1253
- }
1254
- if (p.nodeName==&quot;LI&quot;)
1255
- selectNode(p, null);
1256
- }
1257
-
1258
- function moveHome() {
1259
- selectNode(currentThread);
1260
- }
1261
-
1262
- var currentThreadIndex = null;
1263
-
1264
- function findThread(node){
1265
- while (node &amp;&amp; node.parentNode.nodeName!=&quot;BODY&quot;) {
1266
- node = node.parentNode;
1267
- }
1268
- return node.firstChild;
1269
- }
1270
-
1271
- function selectThread(node){
1272
- var threads = document.getElementsByName(&quot;thread&quot;);
1273
- currentThread = node;
1274
- for (var i=0; i&lt;threads.length; i++) {
1275
- if (threads[i]==currentThread.parentNode)
1276
- currentThreadIndex = i;
1277
- }
1278
- }
1279
-
1280
- function nextThread(){
1281
- var threads = document.getElementsByName(&quot;thread&quot;);
1282
- if (currentThreadIndex==threads.length-1)
1283
- currentThreadIndex = 0;
1284
- else
1285
- currentThreadIndex += 1
1286
- currentThread = threads[currentThreadIndex].firstChild;
1287
- selectNode(currentThread, null);
1288
- }
1289
-
1290
- function previousThread(){
1291
- var threads = document.getElementsByName(&quot;thread&quot;);
1292
- if (currentThreadIndex==0)
1293
- currentThreadIndex = threads.length-1;
1294
- else
1295
- currentThreadIndex -= 1
1296
- currentThread = threads[currentThreadIndex].firstChild;
1297
- selectNode(currentThread, null);
1298
- }
1299
-
1300
- function switchThread(node, event){
1301
- event.cancelBubble = true;
1302
- selectThread(node.nextSibling.firstChild);
1303
- selectNode(currentThread, null);
1304
- }
1305
-
1306
- function handleKeyEvent(event){
1307
- var code = event.charCode ? event.charCode : event.keyCode;
1308
- var str = String.fromCharCode(code);
1309
- switch (str) {
1310
- case &quot;a&quot;: moveLeft(); break;
1311
- case &quot;s&quot;: moveDown(); break;
1312
- case &quot;d&quot;: moveRight(); break;
1313
- case &quot;w&quot;: moveUp(); break;
1314
- case &quot;f&quot;: moveForward(); break;
1315
- case &quot;b&quot;: moveBackward(); break;
1316
- case &quot;x&quot;: toggleChildren(selectedNode.firstChild, event); break;
1317
- case &quot;*&quot;: toggleLI(selectedNode); break;
1318
- case &quot;n&quot;: nextThread(); break;
1319
- case &quot;h&quot;: moveHome(); break;
1320
- case &quot;p&quot;: previousThread(); break;
1321
- }
1322
- }
1323
- document.onkeypress=function(event){ handleKeyEvent(event) };
1324
-
1325
- window.onload=function(){
1326
- var images = document.getElementsByTagName(&quot;img&quot;);
1327
- for (var i=0; i&lt;images.length; i++) {
1328
- var img = images[i];
1329
- if (img.className == &quot;toggle&quot;) {
1330
- img.onclick = function(event){ toggleChildren(this, event); };
1331
- }
1332
- }
1333
- var divs = document.getElementsByTagName(&quot;div&quot;);
1334
- for (i=0; i&lt;divs.length; i++) {
1335
- var div = divs[i];
1336
- if (div.className == &quot;thread&quot;)
1337
- div.onclick = function(event){ switchThread(this, event) };
1338
- }
1339
- var lis = document.getElementsByTagName(&quot;li&quot;);
1340
- for (var i=0; i&lt;lis.length; i++) {
1341
- lis[i].onclick = function(event){ selectNode(this, event); };
1342
- }
1343
- var threads = document.getElementsByName(&quot;thread&quot;);
1344
- currentThreadIndex = 0;
1345
- currentThread = threads[0].firstChild;
1346
- selectNode(currentThread, null);
1347
- }
1348
- &lt;/script&gt;
1349
- end_java_script</span>
1350
- <span class="ruby-keyword">end</span></pre>
863
+ <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 213</span>
864
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">print_java_script</span>
865
+ <span class="ruby-identifier">html</span> = <span class="ruby-identifier">open_asset</span>(<span class="ruby-string">&#39;call_stack_printer.js.html&#39;</span>)
866
+ <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">puts</span> <span class="ruby-identifier">html</span>
867
+ <span class="ruby-keyword">end</span></pre>
1351
868
  </div>
1352
869
 
1353
870
  </div>
@@ -1390,13 +907,13 @@ end_java_script</span>
1390
907
  <span class="ruby-identifier">display</span> = <span class="ruby-identifier">visible</span> <span class="ruby-operator">?</span> <span class="ruby-string">&quot;block&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-string">&quot;none&quot;</span>
1391
908
  <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">print</span> <span class="ruby-node">&quot;&lt;li class=\&quot;color#{color}\&quot; style=\&quot;display:#{display}\&quot;&gt;&quot;</span>
1392
909
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">kids</span>.<span class="ruby-identifier">empty?</span>
1393
- <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">print</span> <span class="ruby-string">&quot;&lt;img src=\&quot;empty.png\&quot;&gt;&quot;</span>
910
+ <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">print</span> <span class="ruby-node">&quot;&lt;a href=\&quot;#\&quot; class=\&quot;toggle empty\&quot; &gt;&lt;/a&gt;&quot;</span>
1394
911
  <span class="ruby-keyword">else</span>
1395
912
  <span class="ruby-identifier">visible_children</span> = <span class="ruby-identifier">kids</span>.<span class="ruby-identifier">any?</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">ci</span><span class="ruby-operator">|</span> (<span class="ruby-identifier">ci</span>.<span class="ruby-identifier">total_time</span><span class="ruby-operator">/</span><span class="ruby-ivar">@overall_time</span>)<span class="ruby-operator">*</span><span class="ruby-value">100</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-identifier">threshold</span>}
1396
913
  <span class="ruby-identifier">image</span> = <span class="ruby-identifier">visible_children</span> <span class="ruby-operator">?</span> (<span class="ruby-identifier">expanded</span> <span class="ruby-operator">?</span> <span class="ruby-string">&quot;minus&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-string">&quot;plus&quot;</span>) <span class="ruby-operator">:</span> <span class="ruby-string">&quot;empty&quot;</span>
1397
- <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">print</span> <span class="ruby-node">&quot;&lt;img class=\&quot;toggle\&quot; src=\&quot;#{image}.png\&quot;&gt;&quot;</span>
914
+ <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">print</span> <span class="ruby-node">&quot;&lt;a href=\&quot;#\&quot; class=\&quot;toggle #{image}\&quot; &gt;&lt;/a&gt;&quot;</span>
1398
915
  <span class="ruby-keyword">end</span>
1399
- <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">printf</span> <span class="ruby-string">&quot; %4.2f%% (%4.2f%%) %s %s\n&quot;</span>, <span class="ruby-identifier">percent_total</span>, <span class="ruby-identifier">percent_parent</span>, <span class="ruby-identifier">link</span>(<span class="ruby-identifier">call_info</span>), <span class="ruby-identifier">graph_link</span>(<span class="ruby-identifier">call_info</span>)
916
+ <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">printf</span> <span class="ruby-string">&quot;&lt;span&gt; %4.2f%% (%4.2f%%) %s %s&lt;/span&gt;\n&quot;</span>, <span class="ruby-identifier">percent_total</span>, <span class="ruby-identifier">percent_parent</span>, <span class="ruby-identifier">link</span>(<span class="ruby-identifier">call_info</span>), <span class="ruby-identifier">graph_link</span>(<span class="ruby-identifier">call_info</span>)
1400
917
  <span class="ruby-keyword">unless</span> <span class="ruby-identifier">kids</span>.<span class="ruby-identifier">empty?</span>
1401
918
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">expanded</span>
1402
919
  <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">print</span> <span class="ruby-string">&quot;&lt;ul&gt;&quot;</span>
@@ -1439,7 +956,7 @@ end_java_script</span>
1439
956
 
1440
957
 
1441
958
  <div class="method-source-code" id="print_title_bar-source">
1442
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 731</span>
959
+ <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 218</span>
1443
960
  <span class="ruby-keyword">def</span> <span class="ruby-identifier">print_title_bar</span>
1444
961
  <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">puts</span> <span class="ruby-value">&lt;&lt;-&quot;end_title_bar&quot;
1445
962
  &lt;div id=&quot;titlebar&quot;&gt;