Sha256: cace4322675a381954852055a245ef5b73737f5386f96fe4c0bd9f851d9be1dc

Contents?: true

Size: 805 Bytes

Versions: 20

Compression:

Stored size: 805 Bytes

Contents

module RubyProf
  class CallInfo
    def depth
      result = 0
      call_info = self.parent

      while call_info
        result += 1
        call_info = call_info.parent
      end
      result
    end

    def children_time
      children.inject(0) do |sum, call_info|
        sum += call_info.total_time
      end
    end

    def stack
      @stack ||= begin
        methods = Array.new
        call_info = self

        while call_info
          methods << call_info.target
          call_info = call_info.parent
        end
        methods.reverse
      end
    end

    def call_sequence
      @call_sequence ||= begin
        stack.map {|method| method.full_name}.join('->')
      end
    end

    def root?
      self.parent.nil?
    end

    def to_s
      "#{call_sequence}"
    end
  end
end

Version data entries

20 entries across 20 versions & 4 rubygems

Version Path
adamh-ruby-prof-0.7.3 lib/ruby-prof/call_info.rb
ruby-prof-danielhoey-0.8.1 lib/ruby-prof/call_info.rb
ruby-prof-0.8.2 lib/ruby-prof/call_info.rb
ruby-prof-0.8.1-x86-mingw32 lib/ruby-prof/call_info.rb
ruby-prof-0.8.1-x86-mswin32 lib/ruby-prof/call_info.rb
ruby-prof-0.8.1 lib/ruby-prof/call_info.rb
ruby-prof-0.7.10 lib/ruby-prof/call_info.rb
ruby-prof-0.7.9 lib/ruby-prof/call_info.rb
ruby-prof-0.7.8 lib/ruby-prof/call_info.rb
ruby-prof-0.7.7 lib/ruby-prof/call_info.rb
ruby-prof-0.7.6 lib/ruby-prof/call_info.rb
ruby-prof-0.7.5 lib/ruby-prof/call_info.rb
ruby-prof-0.7.4 lib/ruby-prof/call_info.rb
rdp-ruby-prof-0.7.4 lib/ruby-prof/call_info.rb
ruby-prof-0.7.2 lib/ruby-prof/call_info.rb
ruby-prof-0.7.2-x86-mswin32-60 lib/ruby-prof/call_info.rb
ruby-prof-0.7.1 lib/ruby-prof/call_info.rb
ruby-prof-0.7.3 lib/ruby-prof/call_info.rb
ruby-prof-0.7.3-x86-mswin32-60 lib/ruby-prof/call_info.rb
ruby-prof-0.7.1-x86-mswin32-60 lib/ruby-prof/call_info.rb