Sha256: 923a0b1490f2364b1dc3659c132e404f18a47b99bcb929df9494112906b26a40

Contents?: true

Size: 614 Bytes

Versions: 9

Compression:

Stored size: 614 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(:object, 1) do
#profile = StackProf.run(:wall, 1000) do
profile = StackProf.run(:cpu, 1000) do
  1_000_000.times do
    A.new
  end
end

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
stackprof-0.2.7 sample.rb
stackprof-0.2.6 sample.rb
stackprof-0.2.5 sample.rb
stackprof-0.2.4 sample.rb
stackprof-0.2.3 sample.rb
stackprof-0.2.2 sample.rb
stackprof-0.2.1 sample.rb
stackprof-0.2.0 sample.rb
stackprof-0.1.0 sample.rb