Class: Rack::Bug::ProfilingSpeedTracer
- Inherits:
-
SpeedTracer
- Object
- SpeedTracer
- Rack::Bug::ProfilingSpeedTracer
- Defined in:
- lib/rack/bug/panels/speedtracer_panel/profiling.rb
Overview
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
Instance Method Summary collapse
Instance Method Details
#after(env, status, headers, body) ⇒ Object
24 25 26 27 |
# File 'lib/rack/bug/panels/speedtracer_panel/profiling.rb', line 24 def after(env, status, headers, body) Kernel::set_trace_func(nil) super end |
#before(env) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/rack/bug/panels/speedtracer_panel/profiling.rb', line 9 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 |