Class: Rack::JRubyProfiler
- Inherits:
-
Object
- Object
- Rack::JRubyProfiler
- Defined in:
- lib/rack_jruby_profiling.rb
Overview
Based on rack/contrib/profiling
Set the profile=call_tree query parameter to view a calltree profile of the request.
Set the download query parameter to download the result locally.
Set the no_profile query parameter to selectively turn off profiling on certain requests.
Both the no_profile and download parameters take a tru-ish value, one of [y, yes, t, true]
Constant Summary collapse
- DEFAULT_CONTENT_TYPE =
'text/html'
- PRINTER_CONTENT_TYPE =
{ :print_flat_text => 'text/plain', :print_graph_text => 'text/plain', :print_call_tree => 'text/plain', :print_graph_html => 'text/html', :print_tree_html => 'text/html' }
- DEFAULT_PRINTER =
:print_tree_html
- PRINTER_METHODS =
{ :flat => :print_flat_text, :graph => :print_graph_text, :call_tree => :print_call_tree, :graph_html => :print_graph_html, :tree_html => :print_tree_html }
- FILE_NAMING =
{ :print_flat_text => 'flat', :print_graph_text => 'graph', :print_call_tree => 'call_tree', :print_graph_html => 'graph', :print_tree_html => 'call_tree' }
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, options = {}) ⇒ JRubyProfiler
constructor
Accepts a :times => [Fixnum] option defaulting to 1.
- #profile_file ⇒ Object
Constructor Details
#initialize(app, options = {}) ⇒ JRubyProfiler
Accepts a :times => [Fixnum] option defaulting to 1.
44 45 46 47 |
# File 'lib/rack_jruby_profiling.rb', line 44 def initialize(app, = {}) @app = app @times = ([:times] || 1).to_i end |
Instance Method Details
#call(env) ⇒ Object
49 50 51 |
# File 'lib/rack_jruby_profiling.rb', line 49 def call(env) profile(env) end |
#profile_file ⇒ Object
53 54 55 |
# File 'lib/rack_jruby_profiling.rb', line 53 def profile_file @profile_file end |