Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 6157

Show
Ignore:
Timestamp:
02/17/07 05:11:55 (1 year ago)
Author:
david
Message:

Added X-Runtime to all responses with the request run time [DHH] (rename from X-Benchmark)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/CHANGELOG

    r6156 r6157  
    11*SVN* 
    22 
    3 * Added X-Benchmark to all responses with the same benchmark data as goes into the log [DHH] 
     3* Added X-Runtime to all responses with the request run time [DHH] 
    44 
    55* Add Mime::Type convenience methods to check the current mime type. [Rick] 
  • trunk/actionpack/lib/action_controller/benchmarking.rb

    r6156 r6157  
    6565      else 
    6666        runtime = [ Benchmark::measure{ perform_action_without_benchmark }.real, 0.0001 ].max 
     67 
    6768        log_message  = "Completed in #{sprintf("%.5f", runtime)} (#{(1 / runtime).floor} reqs/sec)" 
    6869        log_message << rendering_runtime(runtime) if defined?(@rendering_runtime) 
    6970        log_message << active_record_runtime(runtime) if Object.const_defined?("ActiveRecord") && ActiveRecord::Base.connected? 
    70          
    71         log_message_with_status = log_message.dup 
    72         log_message_with_status << " | #{headers["Status"]}" 
    73         log_message_with_status << " [#{complete_request_uri rescue "unknown"}]" 
     71        log_message << " | #{headers["Status"]}" 
     72        log_message << " [#{complete_request_uri rescue "unknown"}]" 
    7473 
    75         response.headers["X-Benchmark"] = log_message 
    76         logger.info(log_message_with_status
     74        logger.info(log_message) 
     75        response.headers["X-Runtime"] = sprintf("%.5f", runtime
    7776      end 
    7877    end