Sha256: 35fd876d93b1b5d7e491ecf35aab302718b405691e7790cfce8532f5f4bc07d0

Contents?: true

Size: 878 Bytes

Versions: 34

Compression:

Stored size: 878 Bytes

Contents

module Rack::Insight


  #Variant of the Speed Tracer Panel that performs a nearly complete profile of
  #all code called during a request.  Note that this will slow overall response
  #time by several orders of magnitude, and may return more data than
  #SpeedTracer is prepared to display
  class ProfilingSpeedTracer < SpeedTracer
    def before(env)
      super
      tracer = env['st.tracer']
      Kernel::set_trace_func proc {|event, file, line, name, binding,classname|
        case event
        when "c-call", "call"
          methodname = classname ? "" : classname
          methodname += name.to_s
          tracer.start_event(file, line, name, classname || "", "")
        when "c-return", "return"
          tracer.finish_event
        end
      }
    end

    def after(env, status, headers, body)
      Kernel::set_trace_func(nil)
      super
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
rack-insight-0.6.4 lib/rack/insight/panels/speedtracer_panel/profiling.rb
rack-insight-0.6.3 lib/rack/insight/panels/speedtracer_panel/profiling.rb
rack-insight-0.6.2 lib/rack/insight/panels/speedtracer_panel/profiling.rb
rack-insight-0.5.30 lib/rack/insight/panels/speedtracer_panel/profiling.rb
rack-insight-0.5.29 lib/rack/insight/panels/speedtracer_panel/profiling.rb
rack-insight-0.5.28 lib/rack/insight/panels/speedtracer_panel/profiling.rb
rack-insight-0.5.27 lib/rack/insight/panels/speedtracer_panel/profiling.rb
rack-insight-0.5.26 lib/rack/insight/panels/speedtracer_panel/profiling.rb
rack-insight-0.5.25 lib/rack/insight/panels/speedtracer_panel/profiling.rb
rack-insight-0.5.24 lib/rack/insight/panels/speedtracer_panel/profiling.rb
rack-insight-0.5.23 lib/rack/insight/panels/speedtracer_panel/profiling.rb
rack-insight-0.5.22 lib/rack/insight/panels/speedtracer_panel/profiling.rb
rack-insight-0.5.21 lib/rack/insight/panels/speedtracer_panel/profiling.rb
rack-insight-0.5.20 lib/rack/insight/panels/speedtracer_panel/profiling.rb
rack-insight-0.5.19 lib/rack/insight/panels/speedtracer_panel/profiling.rb
rack-insight-0.5.18 lib/rack/insight/panels/speedtracer_panel/profiling.rb
rack-insight-0.5.17 lib/rack/insight/panels/speedtracer_panel/profiling.rb
rack-insight-0.5.16 lib/rack/insight/panels/speedtracer_panel/profiling.rb
rack-insight-0.5.15 lib/rack/insight/panels/speedtracer_panel/profiling.rb
rack-insight-0.5.14 lib/rack/insight/panels/speedtracer_panel/profiling.rb