Sha256: bb48b90116fd1d91353be9305f2ebc7f03713023f6b106dcc25be3f1d0ba1c10
Contents?: true
Size: 635 Bytes
Versions: 31
Compression:
Stored size: 635 Bytes
Contents
# This file is part of the "Utopia Framework" project, and is licensed under the GNU AGPLv3. # Copyright 2010 Samuel Williams. All rights reserved. # See <utopia.rb> for licensing details. require 'utopia/middleware' module Utopia module Middleware class Benchmark def initialize(app, options = {}) @app = app @tag = options[:tag] || "{{benchmark}}" end def call(env) start = Time.now response = @app.call(env) finish = Time.now time = "%0.4f" % (finish - start) env['rack.errors'].puts "Benchmark: Request #{env["PATH_INFO"]} took #{time}s" return response end end end end
Version data entries
31 entries across 31 versions & 1 rubygems