class Rack::Profiler

Set the profile=process_time query parameter to download a calltree profile of the request.

Pass the :printer option to pick a different result format.

You can cause every request to be run multiple times by passing the `:times` option to the `use Rack::Profiler` call. You can also run a given request multiple times, by setting the `profiler_runs` query parameter in the request URL.

Constants

CONTENT_TYPES
DEFAULT_PRINTER
MODES

Public Instance Methods

call(env) click to toggle source
# File lib/rack/contrib/profiler.rb, line 34
def call(env)
  if mode = profiling?(env)
    profile(env, mode)
  else
    @app.call(env)
  end
end

Public Class Methods

new(app, options = {}) click to toggle source

Accepts a :printer => [:call_stack|:call_tree|:graph_html|:graph|:flat] option defaulting to :call_stack.

# File lib/rack/contrib/profiler.rb, line 28
def initialize(app, options = {})
  @app = app
  @printer = parse_printer(options[:printer] || DEFAULT_PRINTER)
  @times = (options[:times] || 1).to_i
end