lib/ruby-prof/graph_printer.rb in ruby-prof-0.7.3 vs lib/ruby-prof/graph_printer.rb in ruby-prof-0.7.4
- old
+ new
@@ -125,11 +125,11 @@
@output << " Name"
@output << "\n"
end
def print_parents(thread_id, method)
- method.aggregate_parents.each do |caller|
+ method.aggregate_parents.sort_by(&:total_time).each do |caller|
next unless caller.parent
@output << " " * 2 * PERCENTAGE_WIDTH
@output << sprintf("%#{TIME_WIDTH}.2f", caller.total_time)
@output << sprintf("%#{TIME_WIDTH}.2f", caller.self_time)
@output << sprintf("%#{TIME_WIDTH}.2f", caller.wait_time)
@@ -141,10 +141,10 @@
@output << "\n"
end
end
def print_children(method)
- method.aggregate_children.each do |child|
+ method.aggregate_children.sort_by(&:total_time).reverse.each do |child|
# Get children method
@output << " " * 2 * PERCENTAGE_WIDTH
@output << sprintf("%#{TIME_WIDTH}.2f", child.total_time)