module Rack # Rack::Bench shows total request duration for any request. class Bench def initialize(app) @app = app end def call(env) start_time = Time.now code, headers, body = @app.call(env) end_time = Time.now contents = <<-EOT
TOTAL request duration: #{sprintf("%0.3f",end_time.to_f - start_time.to_f)} s
kiss bench request total
EOT body.each {|p| contents += p } headers['Content-Length'] = contents.length.to_s [ code, headers, contents ] end end end