StackTracy  <%= file %>

<% current_depth = 0 excluded_objects = if events.size > 7500 %w(Array BasicObject Enumerable Fixnum Float Hash IO Kernel Module Mutex Numeric Object Rational String Symbol Thread Time) else [] end corrections = [] cumulatives = {} %>
Time Duration Call
<% events.each_with_index do |event, index| %> <% skip = excluded_objects.include?(event[:object]) || "#{event[:object]}".match(/^#/) cumulatives[event[:call]] ||= {:duration => 0.0, :count => 0} cumulatives[event[:call]][:duration] += event[:duration].to_f cumulatives[event[:call]][:count] += 1 cumulatives[event[:call]][:average] = cumulatives[event[:call]][:duration].to_f / cumulatives[event[:call]][:count].to_f corrections.size.times do |i| event[:depth] <= corrections[0] ? corrections.shift : break end %> <% if skip %> <% corrections.unshift event[:depth] if corrections.empty? || corrections.first != event[:depth] %> <% else %> <% if current_depth < event[:depth] - corrections.size %>
<% elsif current_depth > event[:depth] - corrections.size %> <%= "
" * (current_depth - (event[:depth] - corrections.size)) %> <% end %>
<%= "%.6f" % event[:time] %> <%= event[:duration] ? ("%.6f" % event[:duration]) : "?" %> <%= "   " * (event[:depth] - corrections.size) %> <% if (next_event = events[index + 1]) && next_event[:depth] > event[:depth] %> <%= event[:call] %> <% else %> <%= event[:call] %> <% end %>
<% current_depth = event[:depth] - corrections.size %> <% end %> <% end %> <%= "
" * current_depth %>
<% cumulatives.sort{|(ak, av), (bk, bv)| bv[:average] <=> av[:average]}.each do |call, stats| %>
"> <%= "%.6f" % stats[:average] %> "> <%= "%.6f" % stats[:duration] %> <%= stats[:count] %> ", ">") %>"> <%= call.gsub("<", "<").gsub(">", ">") %>
<% end %>