Sha256: af5a6c46269117aab97a46370d560d5c8353dab4b62db2d52b8e9bf9a7477efa

Contents?: true

Size: 1.28 KB

Versions: 14

Compression:

Stored size: 1.28 KB

Contents

# encoding: utf-8

module RubyProf
  # Prints out the call graph based on CallInfo instances.  This
  # is mainly for debugging purposes as it provides access into
  # into RubyProf's internals.

  class CallInfoPrinter < AbstractPrinter
    TIME_WIDTH = 0

    private

    def print_header(thread)
      @output << "Thread ID: #{thread.id}\n"
      @output << "Fiber ID: #{thread.fiber_id}\n"
      @output << "Total Time: #{thread.total_time}\n"
      @output << "Sort by: #{sort_method}\n"
      @output << "\n"
    end

    def print_methods(thread)
      visitor = CallInfoVisitor.new(thread)

      visitor.visit do |call_info, event|
        if event == :enter
          @output << "  " * call_info.depth
          @output << call_info.target.full_name
          @output << " ("
          @output << "tt:#{sprintf("%#{TIME_WIDTH}.2f", call_info.total_time)}, "
          @output << "st:#{sprintf("%#{TIME_WIDTH}.2f", call_info.self_time)}, "
          @output << "wt:#{sprintf("%#{TIME_WIDTH}.2f", call_info.wait_time)}, "
          @output << "ct:#{sprintf("%#{TIME_WIDTH}.2f", call_info.children_time)}, "
          @output << "call:#{call_info.called}, "
          @output << "rec:#{call_info.recursive}"
          @output << ")"
          @output << "\n"
        end
      end
    end
  end
end

Version data entries

14 entries across 12 versions & 2 rubygems

Version Path
honeybadger-2.4.0 vendor/gems/ruby/2.2.0/gems/ruby-prof-0.15.1/lib/ruby-prof/printers/call_info_printer.rb
honeybadger-2.4.0 vendor/gems/ruby/2.1.0/gems/ruby-prof-0.15.1/lib/ruby-prof/printers/call_info_printer.rb
honeybadger-2.4.0 vendor/gems/ruby/1.9.1/gems/ruby-prof-0.15.1/lib/ruby-prof/printers/call_info_printer.rb
ruby-prof-0.15.5 lib/ruby-prof/printers/call_info_printer.rb
ruby-prof-0.15.4 lib/ruby-prof/printers/call_info_printer.rb
ruby-prof-0.15.3 lib/ruby-prof/printers/call_info_printer.rb
ruby-prof-0.15.2 lib/ruby-prof/printers/call_info_printer.rb
ruby-prof-0.15.1 lib/ruby-prof/printers/call_info_printer.rb
ruby-prof-0.15.0 lib/ruby-prof/printers/call_info_printer.rb
ruby-prof-0.14.2 lib/ruby-prof/printers/call_info_printer.rb
ruby-prof-0.14.1 lib/ruby-prof/printers/call_info_printer.rb
ruby-prof-0.14.0 lib/ruby-prof/printers/call_info_printer.rb
ruby-prof-0.13.1 lib/ruby-prof/printers/call_info_printer.rb
ruby-prof-0.13.0 lib/ruby-prof/printers/call_info_printer.rb