Sha256: faf65d37f2fb5ce70622d152a304c495697a62e1ec8b1a34e9f543182ce50073

Contents?: true

Size: 662 Bytes

Versions: 17

Compression:

Stored size: 662 Bytes

Contents

$:.unshift File.expand_path('../lib', __FILE__)
require 'stackprof'

class A
  def initialize
    pow
    self.class.newobj
    math
  end

  def pow
    2 ** 100
  end

  def self.newobj
    Object.new
    Object.new
  end

  def math
    2.times do
      2 + 3 * 4 ^ 5 / 6
    end
  end
end

#profile = StackProf.run(mode: :object, interval: 1) do
#profile = StackProf.run(mode: :wall, interval: 1000) do
profile = StackProf.run(mode: :cpu, interval: 1000) do
  1_000_000.times do
    A.new
  end
end

result = StackProf::Report.new(profile)
puts
result.print_method(/pow|newobj|math/)
puts
result.print_text
puts
result.print_graphviz
puts
result.print_debug

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
stackprof-0.2.26 sample.rb
stackprof-0.2.25 sample.rb
stackprof-0.2.24 sample.rb
stackprof-0.2.23 sample.rb
stackprof-0.2.22 sample.rb
stackprof-0.2.21 sample.rb
stackprof-0.2.20 sample.rb
stackprof-0.2.19 sample.rb
stackprof-0.2.18 sample.rb
rails_mini_profiler-0.2.0 vendor/bundle/ruby/3.0.0/gems/stackprof-0.2.17/sample.rb
stackprof-0.2.17 sample.rb
stackprof-0.2.16 sample.rb
stackprof-0.2.15 sample.rb
stackprof-0.2.14 sample.rb
stackprof-0.2.13 sample.rb
stackprof-0.2.12 sample.rb
stackprof-0.2.11 sample.rb