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

<=>(other) click to toggle source
   # File lib/ruby-prof/method_info.rb
63 def <=>(other)
64   if other.nil?
65     -1
66   elsif self.full_name == other.full_name
67     0
68   elsif self.total_time < other.total_time
69     -1
70   elsif self.total_time > other.total_time
71     1
72   elsif self.call_trees.min_depth < other.call_trees.min_depth
73     1
74   elsif self.call_trees.min_depth > other.call_trees.min_depth
75     -1
76   else
77     self.full_name <=> other.full_name
78   end
79 end
==(other) click to toggle source
   # File lib/ruby-prof/method_info.rb
59 def ==(other)
60   self.eql?(other)
61 end
called() click to toggle source

The number of times this method was called

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

The time this method’s children took to execute

   # File lib/ruby-prof/method_info.rb
51 def children_time
52   self.total_time - self.self_time - self.wait_time
53 end
eql?(other) click to toggle source
   # File lib/ruby-prof/method_info.rb
55 def eql?(other)
56   self.hash == other.hash
57 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
15 def full_name
16   decorated_class_name = case self.klass_flags
17                          when 0x2
18                            "<Class::#{klass_name}>"
19                          when 0x4
20                            "<Module::#{klass_name}>"
21                          when 0x8
22                            "<Object::#{klass_name}>"
23                          else
24                            klass_name
25                          end
26 
27   "#{decorated_class_name}##{method_name}"
28 end
self_time() click to toggle source

The time this method took to execute

   # File lib/ruby-prof/method_info.rb
41 def self_time
42   self.measurement.self_time
43 end
to_s() click to toggle source
   # File lib/ruby-prof/method_info.rb
81 def to_s
82   "#{self.full_name} (c: #{self.called}, tt: #{self.total_time}, st: #{self.self_time}, wt: #{wait_time}, ct: #{self.children_time})"
83 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
36 def total_time
37   self.measurement.total_time
38 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
46 def wait_time
47   self.measurement.wait_time
48 end