Class: Timer::Timer

Inherits:
TimerGroup show all
Defined in:
lib/pg_graph/timer.rb

Instance Attribute Summary

Attributes inherited from TimerGroup

#nodes, #scale, #unit

Attributes inherited from TimerNode

#label, #timer

Instance Method Summary collapse

Methods inherited from TimerGroup

#factor, #group, #time, #total

Methods inherited from TimerNode

#label_width, #total, #value_width

Constructor Details

#initialize(label = nil, **opts) ⇒ Timer

Returns a new instance of Timer.



107
108
109
# File 'lib/pg_graph/timer.rb', line 107

def initialize(label = nil, **opts)
  super(self, label, **opts)
end

Instance Method Details

#dump(file = $stdout) ⇒ Object



111
112
113
114
115
116
# File 'lib/pg_graph/timer.rb', line 111

def dump(file = $stdout)
  super
  if @nodes.size > 1
    file.printf "%-#{label_width}s: %#{value_width}s#{timer.unit}\n", "Total", format(total)
  end
end