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-0.9.1 plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/flat_text_printer.rb
redcar-0.9.0 plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/flat_text_printer.rb
redcar-0.8.1 plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/flat_text_printer.rb
redcar-0.8 plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/flat_text_printer.rb
tw-studios-jruby-prof-0.1.1 lib/jruby-prof/flat_text_printer.rb
redcar-0.7 plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/flat_text_printer.rb
redcar-0.6.1 plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/flat_text_printer.rb
redcar-0.6 plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/flat_text_printer.rb
redcar-0.6.1dev plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/flat_text_printer.rb
redcar-0.5.1 plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/flat_text_printer.rb
redcar-0.5 plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/flat_text_printer.rb
redcar-0.5.6dev plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/flat_text_printer.rb
redcar-0.5.5dev plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/flat_text_printer.rb
redcar-0.5.4dev plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/flat_text_printer.rb
redcar-0.5.3dev plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/flat_text_printer.rb
redcar-0.5.2dev plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/flat_text_printer.rb
redcar-0.5.1dev plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/flat_text_printer.rb
redcar-0.4.1 plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/flat_text_printer.rb
redcar-0.4 plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/flat_text_printer.rb
redcar-0.3.10.1dev plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/flat_text_printer.rb