Included Modules

RubyProf::CallStackPrinter

prints a HTML visualization of the call tree

Public Instance Methods

application() click to toggle source
# File lib/ruby-prof/printers/call_stack_printer.rb, line 162
def application
  @options[:application] || $PROGRAM_NAME
end
arguments() click to toggle source
# File lib/ruby-prof/printers/call_stack_printer.rb, line 166
def arguments
  ARGV.join(' ')
end
color(p) click to toggle source
# File lib/ruby-prof/printers/call_stack_printer.rb, line 149
def color(p)
  case i = p.to_i
  when 0..5
    "01"
  when 5..10
    "05"
  when 100
    "9"
  else
    "#{i/10}"
  end
end
copy_image_files() click to toggle source
# File lib/ruby-prof/printers/call_stack_printer.rb, line 182
def copy_image_files
  if @output.is_a?(File)
    target_dir = File.dirname(@output.path)
    image_dir = File.join(File.dirname(__FILE__), '..', 'images')
    %(empty plus minus).each do |img|
      source_file = "#{image_dir}/#{img}.png"
      target_file = "#{target_dir}/#{img}.png"
      FileUtils.cp(source_file, target_file) unless File.exist?(target_file)
    end
  end
end
dump(ci) click to toggle source
# File lib/ruby-prof/printers/call_stack_printer.rb, line 145
def dump(ci)
  $stderr.printf "%s/%d t:%f s:%f w:%f  \n", ci, ci.object_id, ci.total_time, ci.self_time, ci.wait_time
end
expansion() click to toggle source
# File lib/ruby-prof/printers/call_stack_printer.rb, line 178
def expansion
  @options[:expansion] || 10.0
end
method_href(method) click to toggle source
# File lib/ruby-prof/printers/call_stack_printer.rb, line 133
def method_href(method)
  h(method.full_name.gsub(/[><#\.\?=:]/,"_") + "_" + @current_thread_id.to_s)
end
name(call_info) click to toggle source
# File lib/ruby-prof/printers/call_stack_printer.rb, line 107
def name(call_info)
  method = call_info.target
  method.full_name
end
sum(a) click to toggle source
# File lib/ruby-prof/printers/call_stack_printer.rb, line 141
def sum(a)
  a.inject(0.0){|s,t| s+=t}
end
threshold() click to toggle source
# File lib/ruby-prof/printers/call_stack_printer.rb, line 174
def threshold
  @options[:threshold] || 1.0
end
title() click to toggle source
# File lib/ruby-prof/printers/call_stack_printer.rb, line 170
def title
  @title ||= @options.delete(:title) || "ruby-prof call tree"
end
total_time(call_infos) click to toggle source
# File lib/ruby-prof/printers/call_stack_printer.rb, line 137
def total_time(call_infos)
  sum(call_infos.map{|ci| ci.total_time})
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.