class RubyProf::CallTreeVisitor

def visit_call_tree(call_tree, depth, &block)

def visit_call_tree(call_tree, depth, &block)
  yield call_tree, :enter
  if @max_depth.nil? || depth < @max_depth
    call_tree.children.each do |child|
      visit_call_tree(child, depth + 1, &block)
    end
  end
  yield call_tree, :exit
end