doc/Rack/RubyProf.html in ruby-prof-0.16.2 vs doc/Rack/RubyProf.html in ruby-prof-0.17.0
- old
+ new
@@ -6,10 +6,11 @@
<title>class Rack::RubyProf - ruby-prof</title>
<script type="text/javascript">
var rdoc_rel_prefix = "../";
+ var index_rel_prefix = "../";
</script>
<script src="../js/jquery.js"></script>
<script src="../js/darkfish.js"></script>
@@ -128,23 +129,22 @@
<div class="method-source-code" id="new-source">
<pre><span class="ruby-comment"># File lib/ruby-prof/rack.rb, line 5</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">app</span>, <span class="ruby-identifier">options</span> = {})
<span class="ruby-ivar">@app</span> = <span class="ruby-identifier">app</span>
- <span class="ruby-ivar">@options</span> = <span class="ruby-identifier">options</span>
- <span class="ruby-ivar">@options</span>[<span class="ruby-value">:min_percent</span>] <span class="ruby-operator">||=</span> <span class="ruby-value">1</span>
- <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>
- <span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">mkdir_p</span>(<span class="ruby-ivar">@tmpdir</span>)
+ <span class="ruby-identifier">options</span>[<span class="ruby-value">:min_percent</span>] <span class="ruby-operator">||=</span> <span class="ruby-value">1</span>
- <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>,
- <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>,
- <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>,
- <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>}
+ <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>
+ <span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">mkdir_p</span>(<span class="ruby-identifier">options</span>[<span class="ruby-value">:path</span>])
<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|js|png|jpeg|jpg|gif)$}</span>]
<span class="ruby-ivar">@only_paths</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:only_paths</span>]
+
+ <span class="ruby-ivar">@max_requests</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:max_requests</span>]
+
+ <span class="ruby-ivar">@options</span> = <span class="ruby-identifier">options</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
@@ -179,27 +179,34 @@
<div class="method-source-code" id="call-source">
- <pre><span class="ruby-comment"># File lib/ruby-prof/rack.rb, line 22</span>
+ <pre><span class="ruby-comment"># File lib/ruby-prof/rack.rb, line 21</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
<span class="ruby-identifier">request</span> = <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">Request</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">env</span>)
<span class="ruby-keyword">if</span> <span class="ruby-identifier">should_profile?</span>(<span class="ruby-identifier">request</span>.<span class="ruby-identifier">path</span>)
+ <span class="ruby-identifier">profiler</span>.<span class="ruby-identifier">resume</span>
<span class="ruby-keyword">begin</span>
- <span class="ruby-identifier">result</span> = <span class="ruby-keyword">nil</span>
- <span class="ruby-identifier">data</span> = <span class="ruby-operator">::</span><span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">Profile</span>.<span class="ruby-identifier">profile</span>(<span class="ruby-identifier">profiling_options</span>) <span class="ruby-keyword">do</span>
- <span class="ruby-identifier">result</span> = <span class="ruby-ivar">@app</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
- <span class="ruby-keyword">end</span>
+ <span class="ruby-identifier">result</span> = <span class="ruby-ivar">@app</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
+ <span class="ruby-keyword">ensure</span>
+ <span class="ruby-identifier">profiler</span>.<span class="ruby-identifier">pause</span>
+ <span class="ruby-keyword">end</span>
- <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>)
- <span class="ruby-identifier">path</span>.<span class="ruby-identifier">slice!</span>(<span class="ruby-value">0</span>)
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">profiler</span>.<span class="ruby-identifier">max_requests_reached?</span>
+ <span class="ruby-identifier">prefix</span> = <span class="ruby-keyword">if</span> <span class="ruby-identifier">aggregate_requests?</span>
+ <span class="ruby-keyword">nil</span>
+ <span class="ruby-keyword">else</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>)[<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>]
+ <span class="ruby-keyword">end</span>
- <span class="ruby-identifier">print</span>(<span class="ruby-identifier">data</span>, <span class="ruby-identifier">path</span>)
- <span class="ruby-identifier">result</span>
+ <span class="ruby-identifier">profiler</span>.<span class="ruby-identifier">print!</span>(<span class="ruby-identifier">prefix</span>)
+ <span class="ruby-identifier">delete_profiler!</span>
<span class="ruby-keyword">end</span>
+
+ <span class="ruby-identifier">result</span>
<span class="ruby-keyword">else</span>
<span class="ruby-ivar">@app</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
<span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
</div>
@@ -218,9 +225,9 @@
</main>
<footer id="validator-badges" role="contentinfo">
<p><a href="http://validator.w3.org/check/referer">Validate</a>
- <p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.2.
+ <p>Generated by <a href="https://rdoc.github.io/rdoc">RDoc</a> 5.1.0.
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
</footer>