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

Changeset 6156

Show
Ignore:
Timestamp:
02/16/07 21:13:02 (2 years ago)
Author:
david
Message:

Added X-Benchmark to all responses with the same benchmark data as goes into the log [DHH]

Files:

Legend:

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

    r6152 r6156  
    11*SVN* 
     2 
     3* Added X-Benchmark to all responses with the same benchmark data as goes into the log [DHH] 
    24 
    35* Add Mime::Type convenience methods to check the current mime type. [Rick] 
  • trunk/actionpack/lib/action_controller/benchmarking.rb

    r4595 r6156  
    6464        perform_action_without_benchmark 
    6565      else 
    66         runtime = [Benchmark::measure{ perform_action_without_benchmark }.real, 0.0001].max 
     66        runtime = [ Benchmark::measure{ perform_action_without_benchmark }.real, 0.0001 ].max 
    6767        log_message  = "Completed in #{sprintf("%.5f", runtime)} (#{(1 / runtime).floor} reqs/sec)" 
    6868        log_message << rendering_runtime(runtime) if defined?(@rendering_runtime) 
    6969        log_message << active_record_runtime(runtime) if Object.const_defined?("ActiveRecord") && ActiveRecord::Base.connected? 
    70         log_message << " | #{headers["Status"]}" 
    71         log_message << " [#{complete_request_uri rescue "unknown"}]" 
    72         logger.info(log_message) 
     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"}]" 
     74 
     75        response.headers["X-Benchmark"] = log_message 
     76        logger.info(log_message_with_status) 
    7377      end 
    7478    end 
    75      
     79 
     80 
    7681    private 
    7782      def rendering_runtime(runtime)