Sha256: cd38ca0e1ce6b41e1f6b8bdf6d42f288c047bd40e263ffbfd5357243d0d05b61

Contents?: true

Size: 1.44 KB

Versions: 53

Compression:

Stored size: 1.44 KB

Contents

class JRubyProf
  class FlatTextPrinter < AbstractPrinter
    TABLE_HEADER = " %self  cumulative    total     self   children    calls self/call total/call  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
        total_duration = 0
        rows = methods.map do |method|
          total    = method.duration
          children = method.childrens_duration
          self_    = total - children
          total_duration += self_ unless self_ < 0
          next if method.name == "#"
          [total, children, self_, method.count, method.name]
        end
        cumulative = 0
        rows = rows.compact.sort_by {|r| r[2]}.reverse
        rows.each do |row|
          total, children, self_, count, name = *row
          cumulative += self_
          self_pc = (self_.to_f/total_duration)*100
          self_per_call = self_.to_f/count
          total_per_call = total.to_f/count
          output.puts "#{("%2.2f" % self_pc).rjust(6)} #{cumulative.to_s.rjust(11)} #{total.to_s.rjust(8)}  #{self_.to_s.rjust(7)}  #{children.to_s.rjust(8)}   #{count.to_s.rjust(7)} #{("%2.2f" % self_per_call).to_s.rjust(9)} #{("%2.2f" % total_per_call).to_s.rjust(10)}  #{name}"
        end
      end
    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/flat_text_printer.rb
redcar-dev-0.12.15dev-java plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/flat_text_printer.rb
redcar-dev-0.12.14dev-java plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/flat_text_printer.rb
redcar-dev-0.12.13dev-java plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/flat_text_printer.rb
redcar-dev-0.12.12dev-java plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/flat_text_printer.rb
redcar-dev-0.12.11dev-java plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/flat_text_printer.rb
redcar-dev-0.12.10dev-java plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/flat_text_printer.rb
redcar-dev-0.12.9dev-java plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/flat_text_printer.rb
redcar-dev-0.12.8dev-java plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/flat_text_printer.rb
redcar-dev-0.12.7dev-java plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/flat_text_printer.rb
redcar-dev-0.12.6dev-java plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/flat_text_printer.rb
redcar-dev-0.12.4dev-java plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/flat_text_printer.rb
redcar-dev-0.12.3dev-java plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/flat_text_printer.rb
redcar-dev-0.12.1dev-java plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/flat_text_printer.rb
redcar-dev-0.12.0dev-java plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/flat_text_printer.rb
redcar-0.11 plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/flat_text_printer.rb
redcar-0.11.0dev plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/flat_text_printer.rb
redcar-0.10 plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/flat_text_printer.rb
redcar-0.9.2 plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/flat_text_printer.rb
rdp-jruby-prof-0.1.0.1 lib/jruby-prof/flat_text_printer.rb