Sha256: 3eaee134dd7721fe345ae06fd76e944d51a0e21501b2b617d58341b7bd323a03

Contents?: true

Size: 1.62 KB

Versions: 53

Compression:

Stored size: 1.62 KB

Contents

class JRubyProf
  class GraphTextPrinter < AbstractPrinter
    TABLE_HEADER = " %total    %self      total      self    children    calls   Name"
    
    def print_on(output)
      thread_set.invocations.each_with_index do |invocation, i|
        output.puts
        output.puts "Thread #{i + 1} / #{thread_set.length}"
        output.puts
        methods = invocation.get_methods.values.sort_by {|m| m.duration }.reverse
        output.puts TABLE_HEADER
        output.puts "-"*100
        total_duration = thread_set.duration
        rows = methods.map do |method|
          method.parent_contexts.each do |context|  
            print_method(output, context, total_duration, false)
          end
          print_method(output, method, total_duration, true)
          method.child_contexts.each do |context|  
            print_method(output, context, total_duration, false)
          end
          output.puts "-"*100
        end
      end
    end
    
    def print_method(output, method, total_duration, print_percents)
      return if method.name =~ /JRubyProf\.stop/
      total    = method.duration
      total_pc = (total.to_f/total_duration)*100
      children = method.childrens_duration
      self_    = total - children
      self_pc  = (self_.to_f/total_duration)*100
      calls    = method.count
      name     = method.name
      if print_percents
        output.print " #{("%2.2f" % total_pc).rjust(6)}% #{("%2.2f" % self_pc).rjust(6)}%"
      else
        output.print "                "
      end
      output.puts "#{total.to_s.rjust(11)} #{self_.to_s.rjust(9)} #{children.to_s.rjust(11)} #{calls.to_s.rjust(8)}  #{name}"
    end
  end
end

Version data entries

53 entries across 53 versions & 5 rubygems

Version Path
redcar-dev-0.12.16dev-java plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/graph_text_printer.rb
redcar-dev-0.12.15dev-java plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/graph_text_printer.rb
redcar-dev-0.12.14dev-java plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/graph_text_printer.rb
redcar-dev-0.12.13dev-java plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/graph_text_printer.rb
redcar-dev-0.12.12dev-java plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/graph_text_printer.rb
redcar-dev-0.12.11dev-java plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/graph_text_printer.rb
redcar-dev-0.12.10dev-java plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/graph_text_printer.rb
redcar-dev-0.12.9dev-java plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/graph_text_printer.rb
redcar-dev-0.12.8dev-java plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/graph_text_printer.rb
redcar-dev-0.12.7dev-java plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/graph_text_printer.rb
redcar-dev-0.12.6dev-java plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/graph_text_printer.rb
redcar-dev-0.12.4dev-java plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/graph_text_printer.rb
redcar-dev-0.12.3dev-java plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/graph_text_printer.rb
redcar-dev-0.12.1dev-java plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/graph_text_printer.rb
redcar-dev-0.12.0dev-java plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/graph_text_printer.rb
redcar-0.11 plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/graph_text_printer.rb
redcar-0.11.0dev plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/graph_text_printer.rb
redcar-0.10 plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/graph_text_printer.rb
redcar-0.9.2 plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/graph_text_printer.rb
rdp-jruby-prof-0.1.0.1 lib/jruby-prof/graph_text_printer.rb