Sha256: 0f0a96a448590b33111708442e19bb320b55e2f748eea71b6ac0781a74d32499
Contents?: true
Size: 1.42 KB
Versions: 2
Compression:
Stored size: 1.42 KB
Contents
module ActionController class Base def process_with_browser_profiling(request, response, method = :perform_action, *arguments) browser_output = request.parameters.key?('browser_profile!') || request.parameters[:params].key?('browser_profile!') || ENV["BROWSER_PROFILE"] file_output = request.parameters.key?('file_profile') || request.parameters[:params].key?('file_profile!') || ENV["FILE_PROFILE"] if (browser_output or file_output) # Only require these files in needed require 'ruby-prof' require 'ruby-prof/graph_html_printer_enhanced' #run the process through a profile block profile_results = RubyProf.profile { response = process_without_browser_profiling(request,response, method, *arguments); } #Use the enhanced html printer to get better results printer = RubyProf::GraphHtmlPrinterEnhanced.new(profile_results) #determine output location if file_output printer.print(File.new("#{RAILS_ROOT}/log/profile_out.html","w")) else response.body << printer.print("",0) end #reset the content length so the profiling data is included in the response response.send("set_content_length!") response else process_without_browser_profiling(request, response, method, *arguments) end end alias_method_chain :process, :browser_profiling end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
browser-prof-1.2.4 | lib/browser-prof.rb |
browser-prof-1.2.3 | lib/browser-prof.rb |