class RubyProf::CallTree

The CallTree class is used to track the relationships between methods. It is a helper class used by RubyProf::MethodInfo to keep track of which methods called a given method and which methods a given method called. Each CallTree has a parent and target method. You cannot create a CallTree object directly, they are generated while running a profile.

Public Instance Methods

<=>(other) click to toggle source

Compares two CallTree instances. The comparison is based on the CallTree#parent, CallTree#target, and total time.

# File lib/ruby-prof/call_tree.rb, line 36
def <=>(other)
  if self.target == other.target && self.parent == other.parent
    0
  elsif self.total_time < other.total_time
    -1
  elsif self.total_time > other.total_time
    1
  else
    self.target.full_name <=> other.target.full_name
  end
end
called() click to toggle source

The number of times the parent method called the target method

# File lib/ruby-prof/call_tree.rb, line 10
def called
  self.measurement.called
end
children_time() click to toggle source

The time spent in child methods resulting from the parent method calling the target method

# File lib/ruby-prof/call_tree.rb, line 30
def children_time
  self.total_time - self.self_time - self.wait_time
end
self_time() click to toggle source

The self time (of the parent) resulting from the parent method calling the target method

# File lib/ruby-prof/call_tree.rb, line 20
def self_time
  self.measurement.self_time
end
total_time() click to toggle source

The total time resulting from the parent method calling the target method

# File lib/ruby-prof/call_tree.rb, line 15
def total_time
  self.measurement.total_time
end
wait_time() click to toggle source

The wait time (of the parent) resulting from the parent method calling the target method

# File lib/ruby-prof/call_tree.rb, line 25
def wait_time
  self.measurement.wait_time
end