class RubyProf::MethodInfo

The MethodInfo class is used to track information about each method that is profiled. You cannot create a MethodInfo object directly, they are generated while running a profile.

Public Instance Methods

called() click to toggle source

The number of times this method was called

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

The time this method's children took to execute

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

Returns the full name of a class. The interpretation of method names is:

  • MyObject#test - An method defined in a class

  • <Class:MyObject>#test - A method defined in a singleton class.

  • <Module:MyObject>#test - A method defined in a singleton module.

  • <Object:MyObject>#test - A method defined in a singleton object.

# File lib/ruby-prof/method_info.rb, line 15
def full_name
  decorated_class_name = case self.klass_flags
                         when 0x2
                           "<Class::#{klass_name}>"
                         when 0x4
                           "<Module::#{klass_name}>"
                         when 0x8
                           "<Object::#{klass_name}>"
                         else
                           klass_name
                         end

  "#{decorated_class_name}##{method_name}"
end
self_time() click to toggle source

The time this method took to execute

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

The total time this method took - includes self time + wait time + child time

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

The time this method waited for other fibers/threads to execute

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