class RubyProf::MethodInfo
Public Instance Methods
<=>(other)
click to toggle source
# File lib/ruby-prof/method_info.rb, line 6 def <=>(other) if self.total_time < other.total_time -1 elsif self.total_time > other.total_time 1 elsif self.min_depth < other.min_depth 1 elsif self.min_depth > other.min_depth -1 else self.full_name <=> other.full_name end end
aggregate_children()
click to toggle source
# File lib/ruby-prof/method_info.rb, line 120 def aggregate_children # Group call info's based on their targets groups = self.children.each_with_object({}) do |call_info, hash| key = call_info.target (hash[key] ||= []) << call_info end groups.map do |key, value| AggregateCallInfo.new(value) end end
aggregate_parents()
click to toggle source
# File lib/ruby-prof/method_info.rb, line 108 def aggregate_parents # Group call info's based on their parents groups = self.call_infos.each_with_object({}) do |call_info, hash| key = call_info.parent ? call_info.parent.target : self (hash[key] ||= []) << call_info end groups.map do |key, value| AggregateCallInfo.new(value) end end
called()
click to toggle source
# File lib/ruby-prof/method_info.rb, line 32 def called @called ||= begin call_infos.inject(0) do |sum, call_info| sum += call_info.called end end end
children()
click to toggle source
# File lib/ruby-prof/method_info.rb, line 100 def children @children ||= call_infos.map(&:children).flatten end
children_time()
click to toggle source
# File lib/ruby-prof/method_info.rb, line 67 def children_time @children_time ||= begin call_infos.inject(0) do |sum, call_info| sum += call_info.children_time unless call_info.recursive sum end end end
clear_cached_values_which_depend_on_recursiveness()
click to toggle source
# File lib/ruby-prof/method_info.rb, line 28 def clear_cached_values_which_depend_on_recursiveness @total_time = @self_time = @wait_time = @children_time = nil end
detect_recursion()
click to toggle source
# File lib/ruby-prof/method_info.rb, line 20 def detect_recursion call_infos.each(&:detect_recursion) end
eliminate!()
click to toggle source
remove method from the call graph. should not be called directly.
# File lib/ruby-prof/method_info.rb, line 137 def eliminate! # $stderr.puts "eliminating #{self}" call_infos.each{ |call_info| call_info.eliminate! } call_infos.clear end
min_depth()
click to toggle source
# File lib/ruby-prof/method_info.rb, line 76 def min_depth @min_depth ||= call_infos.map(&:depth).min end
non_recursive()
click to toggle source
# File lib/ruby-prof/method_info.rb, line 96 def non_recursive @non_recursive ||= call_infos.all?(&:non_recursive?) ? 1 : 0 end
non_recursive?()
click to toggle source
# File lib/ruby-prof/method_info.rb, line 92 def non_recursive? non_recursive == 1 end
parents()
click to toggle source
# File lib/ruby-prof/method_info.rb, line 104 def parents @parents ||= call_infos.map(&:parent) end
recalc_recursion()
click to toggle source
# File lib/ruby-prof/method_info.rb, line 24 def recalc_recursion call_infos.each(&:recalc_recursion) end
recursive?()
click to toggle source
# File lib/ruby-prof/method_info.rb, line 88 def recursive? call_infos.detect(&:recursive) end
root?()
click to toggle source
# File lib/ruby-prof/method_info.rb, line 80 def root? @root ||= begin call_infos.find do |call_info| not call_info.root? end.nil? end end
self_time()
click to toggle source
# File lib/ruby-prof/method_info.rb, line 49 def self_time @self_time ||= begin call_infos.inject(0) do |sum, call_info| sum += call_info.self_time unless call_info.recursive sum end end end
to_s()
click to toggle source
# File lib/ruby-prof/method_info.rb, line 132 def to_s "#{self.full_name} (c: #{self.called}, tt: #{self.total_time}, st: #{self.self_time}, ct: #{self.children_time})" end
total_time()
click to toggle source
# File lib/ruby-prof/method_info.rb, line 40 def total_time @total_time ||= begin call_infos.inject(0) do |sum, call_info| sum += call_info.total_time unless call_info.recursive sum end end end
wait_time()
click to toggle source
# File lib/ruby-prof/method_info.rb, line 58 def wait_time @wait_time ||= begin call_infos.inject(0) do |sum, call_info| sum += call_info.wait_time unless call_info.recursive sum end end end