class RubyProf::CallStackPrinter
def print_stack(output, visited, call_tree, parent_time)
def print_stack(output, visited, call_tree, parent_time) total_time = call_tree.total_time percent_parent = (total_time/parent_time)*100 percent_total = (total_time/@overall_time)*100 return unless percent_total > min_percent color = self.color(percent_total) visible = percent_total >= threshold expanded = percent_total >= expansion display = visible ? "block" : "none" output << "<li class=\"color#{color}\" style=\"display:#{display}\">" << "\n" if visited.include?(call_tree) output << "<a href=\"#\" class=\"toggle empty\" ></a>" << "\n" output << "<span>%s %s</span>" % [link(call_tree.target, true), graph_link(call_tree)] << "\n" else visited << call_tree if call_tree.children.empty? output << "<a href=\"#\" class=\"toggle empty\" ></a>" << "\n" else visible_children = call_tree.children.any?{|ci| (ci.total_time/@overall_time)*100 >= threshold} image = visible_children ? (expanded ? "minus" : "plus") : "empty" output << "<a href=\"#\" class=\"toggle #{image}\" ></a>" << "\n" end output << "<span>%4.2f%% (%4.2f%%) %s %s</span>" % [percent_total, percent_parent, link(call_tree.target, false), graph_link(call_tree)] << "\n" unless call_tree.children.empty? output << (expanded ? '<ul>' : '<ul style="display:none">') << "\n" call_tree.children.sort_by{|c| -c.total_time}.each do |child_call_tree| print_stack(output, visited, child_call_tree, total_time) end output << '</ul>' << "\n" end visited.delete(call_tree) end output << '</li>' << "\n" end