Sha256: 0e0936ac07d29eddabdf3c749fca00e914d93b29b84bbca4d2ac5dd9b3892d12
Contents?: true
Size: 748 Bytes
Versions: 5
Compression:
Stored size: 748 Bytes
Contents
module Rack class RubyProf def initialize(app) @app = app end def call(env) ::RubyProf.start result = @app.call(env) data = ::RubyProf.stop print(data) result end def print(data) require 'tmpdir' # late require so we load on demand only printers = {::RubyProf::FlatPrinter => ::File.join(Dir.tmpdir, 'profile.txt'), ::RubyProf::GraphHtmlPrinter => ::File.join(Dir.tmpdir, 'profile.html')} printers.each do |printer_klass, file_name| printer = printer_klass.new(data) ::File.open(file_name, 'wb') do |file| printer.print(file, :min_percent => 0.00000001 ) end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems