Sha256: 755afcca9bd1d06703780311164db6a5c3f6d5fa8677dcb7b249bc5381560567
Contents?: true
Size: 814 Bytes
Versions: 20
Compression:
Stored size: 814 Bytes
Contents
require 'benchmark' module Rack::Insight class TimerPanel < Panel def call(env) status, headers, body = nil @times = Benchmark.measure do status, headers, body = @app.call(env) end store(env, [ ["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)] ]) return [status, headers, body] end def heading_for_request(number) measurements = retrieve(number).first measurements.last.last end def content_for_request(number) render_template "panels/timer", :measurements => retrieve(number).first end end end
Version data entries
20 entries across 20 versions & 1 rubygems