class RubyProf::FlameGraphPrinter
def build_flame_data(call_tree, depth = 0)
def build_flame_data(call_tree, depth = 0) node = { name: call_tree.target.full_name, value: call_tree.total_time, self_value: call_tree.self_time, called: call_tree.called, children: [] } if @max_depth.nil? || depth < @max_depth call_tree.children.each do |child| node[:children] << build_flame_data(child, depth + 1) end end node end