class RackGcProfiler::Middleware
Constants
- GC_RUNS_HEADER
- GC_TIME_FORMAT
- GC_TIME_HEADER
Attributes
profiler[R]
Public Class Methods
new(app, profiler = GC::Profiler)
click to toggle source
# File lib/rack_gc_profiler.rb, line 12 def initialize(app, profiler = GC::Profiler) @app = app @profiler = profiler end
Public Instance Methods
call(env)
click to toggle source
# File lib/rack_gc_profiler.rb, line 17 def call(env) @profiler.enable status, headers, body = @app.call(env) headers[GC_TIME_HEADER] = GC_TIME_FORMAT % @profiler.total_time headers[GC_RUNS_HEADER] = @profiler.raw_data.size.to_s [status, headers, body] ensure @profiler.disable @profiler.clear end