module DebugTimer

Constants

VERSION

Public Class Methods

configure() { |self| ... } click to toggle source
# File lib/debug_timer/config.rb, line 4
def self.configure
  yield self
end
logger() click to toggle source
# File lib/debug_timer/logger.rb, line 6
def self.logger
  @@logger ||= Logger.new($stdout)
end
logger=(logger) click to toggle source
# File lib/debug_timer/logger.rb, line 2
def self.logger=(logger)
  @@logger = logger
end
object_allocations=(object_allocations) click to toggle source
# File lib/debug_timer/config.rb, line 8
def self.object_allocations=(object_allocations)
  @@object_allocations = object_allocations
end
object_allocations?() click to toggle source
# File lib/debug_timer/config.rb, line 12
def self.object_allocations?
  @@object_allocations
end
start(name = '---') { || ... } click to toggle source
# File lib/debug_timer.rb, line 9
def self.start(name = '---', &block)
  parent = @current_node

  @current_node = Node.new(name)
  result = yield
  @current_node.stop()

  if parent
    parent.children << @current_node
  else
    print_tree(@current_node)
  end

  result
  ensure
    @current_node = parent
end

Private Class Methods

gather_nodes(node, depth = 0) click to toggle source
# File lib/debug_timer.rb, line 29
def self.gather_nodes(node, depth = 0)
  nodes = []
  nodes << node.print(depth: depth)
  node.children.each do |node|
    nodes = nodes + gather_nodes(node, depth+1)
  end
  nodes
end
print_tree(node) click to toggle source