Sha256: 10c9a1b43f949c6352d55f086856f0255a9154fe500a474ac844320f38200b6f
Contents?: true
Size: 906 Bytes
Versions: 3
Compression:
Stored size: 906 Bytes
Contents
require "benchmark" module Rack module Bug class TimerPanel < Panel def name "timer" end def call(env) status, headers, body = nil @times = Benchmark.measure do status, headers, body = @app.call(env) end @measurements = [ ["User CPU time", "%.2fms" % (@times.utime * 1_000)], ["System CPU time", "%.2fms" % (@times.stime * 1_000)], ["Total CPU time", "%.2fms" % (@times.total * 1_000)], ["Elapsed time", "%.2fms" % (@times.real * 1_000)] ] env["rack-bug.panels"] << self return [status, headers, body] end def heading "%.2fms" % (@times.real * 1_000) end def content render_template "panels/timer", :measurements => @measurements end end end end
Version data entries
3 entries across 3 versions & 3 rubygems
Version | Path |
---|---|
jeroenvandijk-rack-bug-0.2.1 | lib/rack/bug/panels/timer_panel.rb |
wested-rack-bug-0.2.2.1 | lib/rack/bug/panels/timer_panel.rb |
rack-bug-0.2.1 | lib/rack/bug/panels/timer_panel.rb |