Skip to content

Instantly share code, notes, and snippets.

@paul
Created October 9, 2009 23:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paul/206438 to your computer and use it in GitHub Desktop.
Save paul/206438 to your computer and use it in GitHub Desktop.
require 'hitimes'
module Rack
class Runtime
def initialize(app)
@app = app
end
def call(env)
interval = Hitimes::Interval.now
status, headers, body = @app.call(env)
duration = interval.stop
headers['X-Runtime'] = ("%0.6f" % duration)
[status, headers, body]
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment