Class: DebugTimer::Node
- Inherits:
-
Object
- Object
- DebugTimer::Node
- Defined in:
- lib/debug_timer/node.rb
Instance Attribute Summary collapse
-
#children ⇒ Object
readonly
Returns the value of attribute children.
-
#end_gc_stats ⇒ Object
readonly
Returns the value of attribute end_gc_stats.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
-
#start_gc_stats ⇒ Object
readonly
Returns the value of attribute start_gc_stats.
-
#start_time ⇒ Object
readonly
Returns the value of attribute start_time.
-
#time_elapsed ⇒ Object
readonly
Returns the value of attribute time_elapsed.
Instance Method Summary collapse
-
#initialize(name) ⇒ Node
constructor
A new instance of Node.
- #print(depth:) ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(name) ⇒ Node
Returns a new instance of Node.
4 5 6 7 8 9 10 11 |
# 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 |
Instance Attribute Details
#children ⇒ Object (readonly)
Returns the value of attribute children.
3 4 5 |
# File 'lib/debug_timer/node.rb', line 3 def children @children end |
#end_gc_stats ⇒ Object (readonly)
Returns the value of attribute end_gc_stats.
3 4 5 |
# File 'lib/debug_timer/node.rb', line 3 def end_gc_stats @end_gc_stats end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/debug_timer/node.rb', line 3 def name @name end |
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
3 4 5 |
# File 'lib/debug_timer/node.rb', line 3 def parent @parent end |
#start_gc_stats ⇒ Object (readonly)
Returns the value of attribute start_gc_stats.
3 4 5 |
# File 'lib/debug_timer/node.rb', line 3 def start_gc_stats @start_gc_stats end |
#start_time ⇒ Object (readonly)
Returns the value of attribute start_time.
3 4 5 |
# File 'lib/debug_timer/node.rb', line 3 def start_time @start_time end |
#time_elapsed ⇒ Object (readonly)
Returns the value of attribute time_elapsed.
3 4 5 |
# File 'lib/debug_timer/node.rb', line 3 def time_elapsed @time_elapsed end |
Instance Method Details
#print(depth:) ⇒ Object
20 21 22 |
# File 'lib/debug_timer/node.rb', line 20 def print(depth:) NodePrinter.new(self).print(depth) end |
#stop ⇒ Object
13 14 15 16 17 18 |
# 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 |