class DebugTimer::NodePrinter
Public Class Methods
new(node)
click to toggle source
# File lib/debug_timer/node_printer.rb, line 3 def initialize(node) @node = node end
Public Instance Methods
print(depth)
click to toggle source
Should return a string of the printed
# File lib/debug_timer/node_printer.rb, line 8 def print(depth) spaces = " ".freeze * depth "#{left_stats} #{spaces} └── #{@node.name}" end
Private Instance Methods
left_stats()
click to toggle source
# File lib/debug_timer/node_printer.rb, line 14 def left_stats stats = [seconds_elapsed] if DebugTimer.object_allocations? stats << "T_OBJECT: #{total_objects_allocated}" stats << "FREE: #{total_free_count}" end stats.join(" | ") end
seconds_elapsed()
click to toggle source
# File lib/debug_timer/node_printer.rb, line 31 def seconds_elapsed [0.0001, @node.time_elapsed].max.round(4).to_s.ljust(6, '0'.freeze) end
total_free_count()
click to toggle source
# File lib/debug_timer/node_printer.rb, line 27 def total_free_count @node.end_gc_stats[:FREE] - @node.start_gc_stats[:FREE] end
total_objects_allocated()
click to toggle source
# File lib/debug_timer/node_printer.rb, line 23 def total_objects_allocated @node.end_gc_stats[:T_OBJECT] - @node.start_gc_stats[:T_OBJECT] end