class Rack::RubyProf::RackProfiler

Public Class Methods

new(options) click to toggle source
# File lib/ruby-prof/rack.rb, line 52
def initialize(options)
  @options = options

  @profile = ::RubyProf::Profile.new(profiling_options)
  @profile.start
  @profile.pause

  @printer_klasses = options[:printers] || default_printers

  @tmpdir = options[:path]

  @max_requests = options[:max_requests] || 1
  @requests_count = 0

  @printed = false
  # if running across multiple requests, we want to make sure that the
  # ongoing profile is not lost if the process shuts down before the
  # max request count is reached
  ObjectSpace.define_finalizer(self, proc { print! })
end

Public Instance Methods

max_requests_reached?() click to toggle source
# File lib/ruby-prof/rack.rb, line 82
def max_requests_reached?
  @requests_count >= @max_requests
end
pause() click to toggle source
# File lib/ruby-prof/rack.rb, line 77
def pause
  @profile.pause
  @requests_count += 1
end
print!(prefix = nil) click to toggle source
resume() click to toggle source
# File lib/ruby-prof/rack.rb, line 73
def resume
  @profile.resume
end