Sha256: 714a2b510bb2a2c19d033824c192c41e60191fa04a7d77c56885c46ba9ad0103
Contents?: true
Size: 767 Bytes
Versions: 2
Compression:
Stored size: 767 Bytes
Contents
# encoding: utf-8 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ruby-prof-0.11.0.rc1-x86-mingw32 | lib/ruby-prof/rack.rb |
ruby-prof-0.11.0.rc1 | lib/ruby-prof/rack.rb |