class DebugTimer::Node
Attributes
children[R]
end_gc_stats[R]
name[R]
parent[R]
start_gc_stats[R]
start_time[R]
time_elapsed[R]
Public Class Methods
new(name)
click to toggle source
# File lib/debug_timer/node.rb, line 4 def initialize(name) @name = name @children = [] if DebugTimer.object_allocations? grab_object_allocations(true) end @start_time = Time.now end
Public Instance Methods
print(depth:)
click to toggle source
# File lib/debug_timer/node.rb, line 20 def print(depth:) NodePrinter.new(self).print(depth) end
stop()
click to toggle source
# File lib/debug_timer/node.rb, line 13 def stop @time_elapsed = Time.now - start_time if DebugTimer.object_allocations? grab_object_allocations(false) end end
Private Instance Methods
grab_object_allocations(start)
click to toggle source
# File lib/debug_timer/node.rb, line 26 def grab_object_allocations(start) if start # GC.disable # puts ObjectSpace.count_objects.inspect @start_gc_stats = ObjectSpace.count_objects else # puts ObjectSpace.count_objects.inspect @end_gc_stats = ObjectSpace.count_objects # GC.enable end end