class Rack::RubyProf::RackProfiler

Public Class Methods

new(options) click to toggle source
   # File lib/ruby-prof/rack.rb
53 def initialize(options)
54   @options = options
55 
56   @profile = ::RubyProf::Profile.new(profiling_options)
57   @profile.start
58   @profile.pause
59 
60   @printer_klasses = options[:printers] || default_printers
61 
62   @tmpdir = options[:path]
63 
64   @max_requests = options[:max_requests] || 1
65   @requests_count = 0
66 
67   @printed = false
68   # if running across multiple requests, we want to make sure that the
69   # ongoing profile is not lost if the process shuts down before the
70   # max request count is reached
71   ObjectSpace.define_finalizer(self, proc { print! })
72 end

Public Instance Methods

max_requests_reached?() click to toggle source
   # File lib/ruby-prof/rack.rb
83 def max_requests_reached?
84   @requests_count >= @max_requests
85 end
pause() click to toggle source
   # File lib/ruby-prof/rack.rb
78 def pause
79   @profile.pause
80   @requests_count += 1
81 end
print!(prefix = nil) click to toggle source
resume() click to toggle source
   # File lib/ruby-prof/rack.rb
74 def resume
75   @profile.resume
76 end