Sha256: aa303a3e10423bf0142d6570f741caeeeb1b812fe090a10af1030889a6bc4fee

Contents?: true

Size: 982 Bytes

Versions: 411

Compression:

Stored size: 982 Bytes

Contents

require 'prof'

module Prof #:nodoc:
  # Adapted from Shugo Maeda's unprof.rb
  def self.print_profile(results, io = $stderr)
    total = results.detect { |i|
      i.method_class.nil? && i.method_id == :"#toplevel"
    }.total_time
    total = 0.001 if total < 0.001

    io.puts "  %%   cumulative   self              self     total"
    io.puts " time   seconds   seconds    calls  ms/call  ms/call  name"

    sum = 0.0
    for r in results
      sum += r.self_time

      name =  if r.method_class.nil?
                r.method_id.to_s
              elsif r.method_class.is_a?(Class)
                "#{r.method_class}##{r.method_id}"
              else
                "#{r.method_class}.#{r.method_id}"
              end
      io.printf "%6.2f %8.3f  %8.3f %8d %8.2f %8.2f  %s\n",
        r.self_time / total * 100,
        sum,
        r.self_time,
        r.count,
        r.self_time * 1000 / r.count,
        r.total_time * 1000 / r.count,
        name
    end
  end
end

Version data entries

411 entries across 371 versions & 38 rubygems

Version Path
railties-3.2.14.rc1 lib/rails/rubyprof_ext.rb
swipe-rails-0.0.5 vendor/bundle/gems/railties-3.2.13/lib/rails/rubyprof_ext.rb
active_mailer-0.0.9 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/railties-3.2.12/lib/rails/rubyprof_ext.rb
active_mailer-0.0.8 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/railties-3.2.12/lib/rails/rubyprof_ext.rb
active_mailer-0.0.7 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/railties-3.2.12/lib/rails/rubyprof_ext.rb
active_mailer-0.0.6 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/railties-3.2.12/lib/rails/rubyprof_ext.rb
font-awesome-rails-3.1.1.2 vendor/ruby/1.9.1/gems/railties-3.2.12/lib/rails/rubyprof_ext.rb
font-awesome-rails-3.1.1.2 vendor/ruby/2.0.0/gems/railties-3.2.12/lib/rails/rubyprof_ext.rb
font-awesome-rails-3.1.1.2 vendor/ruby/1.9.1/gems/railties-3.2.13/lib/rails/rubyprof_ext.rb
font-awesome-rails-3.1.1.1 vendor/ruby/1.9.1/gems/railties-3.2.13/lib/rails/rubyprof_ext.rb
font-awesome-rails-3.1.1.1 vendor/ruby/1.9.1/gems/railties-3.2.12/lib/rails/rubyprof_ext.rb
font-awesome-rails-3.1.1.1 vendor/ruby/2.0.0/gems/railties-3.2.12/lib/rails/rubyprof_ext.rb
challah-1.0.0.beta3 vendor/bundle/gems/railties-3.2.13/lib/rails/rubyprof_ext.rb
fc-webicons-0.0.4 vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/rubyprof_ext.rb
challah-1.0.0.beta2 vendor/bundle/gems/railties-3.2.13/lib/rails/rubyprof_ext.rb
challah-1.0.0.beta vendor/bundle/gems/railties-3.2.11/lib/rails/rubyprof_ext.rb
challah-1.0.0.beta vendor/bundle/gems/railties-3.2.13/lib/rails/rubyprof_ext.rb
fc-webicons-0.0.3 vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/rubyprof_ext.rb
fc-webicons-0.0.2 vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/rubyprof_ext.rb
fc-webicons-0.0.1 vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/rubyprof_ext.rb