module ZTK::Profiler::Timer::ClassMethods
Public Instance Methods
add(timer)
click to toggle source
# File lib/ztk/profiler/timer/class_methods.rb, line 26 def add(timer) @@timers << timer @@timers_by_parent[timer.parent] << timer @@timers_by_name[timer.name] << timer true end
benchmark_nested_total()
click to toggle source
# File lib/ztk/profiler/timer/class_methods.rb, line 66 def benchmark_nested_total @@benchmark_nested_total ||= @@timers.map(&:benchmark_nested).reduce(&:+) @@benchmark_nested_total end
benchmark_total()
click to toggle source
# File lib/ztk/profiler/timer/class_methods.rb, line 61 def benchmark_total @@benchmark_total ||= @@timers.map(&:benchmark).reduce(&:+) @@benchmark_total end
count()
click to toggle source
# File lib/ztk/profiler/timer/class_methods.rb, line 57 def count @@timers.count end
nested_time(name=nil, parent=nil)
click to toggle source
# File lib/ztk/profiler/timer/class_methods.rb, line 43 def nested_time(name=nil, parent=nil) result = 0.0 child_timers = @@timers_by_parent[parent] child_timers.each do |child_timer| if (child_timer.name == name) result += child_timer.benchmark_nested end result += nested_time(name, child_timer) end result end
reset()
click to toggle source
# File lib/ztk/profiler/timer/class_methods.rb, line 35 def reset @@timers = Array.new @@timers_by_name = Hash.new { |hash, key| hash[key] = Array.new } @@timers_by_parent = Hash.new { |hash, key| hash[key] = Array.new } true end
timers()
click to toggle source
# File lib/ztk/profiler/timer/class_methods.rb, line 14 def timers @@timers end
timers_by_name()
click to toggle source
# File lib/ztk/profiler/timer/class_methods.rb, line 22 def timers_by_name @@timers_by_name end
timers_by_parent()
click to toggle source
# File lib/ztk/profiler/timer/class_methods.rb, line 18 def timers_by_parent @@timers_by_parent end
total_time()
click to toggle source
# File lib/ztk/profiler/timer/class_methods.rb, line 71 def total_time @@total_time ||= @@timers_by_parent[nil].map(&:benchmark).reduce(&:+) @@total_time end