StackTracy  <%= file %>

<% limited = events.size > limit threshold = nil unless limited || slows_only excluded_objects = if limited %w(Array BasicObject Enumerable Fixnum Float Hash IO Integer Kernel Module Mutex Numeric Object Rational String Symbol Thread Time) else [] end comment_depth = nil last_depth = nil last_duration = nil corrections = [] cumulatives = {} %>
Time Duration Call
<% events.each_with_index do |event, index| skip = begin ((event[:call][0] != "\"") && (messages_only || (slows_only && threshold && event[:duration] < threshold))) || (excluded_objects.include?(event[:object]) || "#{event[:object]}".match(/^#/)) end if skip corrections.unshift event[:depth] if corrections.empty? || corrections.first != event[:depth] else 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 last_depth.to_i < event[:depth] - corrections.size %>
<% if threshold && comment_depth.nil? && last_duration && last_duration < threshold %><% comment_depth = event[:depth] - corrections.size %><%= "\n\n
" else "\n
" end end.reverse.join("") %><%= close_tags %><% end %>
<%= "%.6f" % event[:time] %> <%= event[:duration] ? ("%.6f" % event[:duration]) : "?" %> <% if (next_event = events[index + 1]) && next_event[:depth] > event[:depth] %><%= event[:call].gsub(/^"(.*)"$/){ "#{$1}" } %><% else %><%= event[:call].gsub(/^"(.*)"$/){ "#{$1}" } %><% end %>
<% last_depth = event[:depth] - corrections.size last_duration = event[:duration] end end close_tags = (1..last_depth.to_i).collect do |depth| if comment_depth && depth == comment_depth comment_depth = nil "\n-->\n
" else "\n
" end end.reverse.join("") %><%= close_tags %>
Average Duration Count Call
<% 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(">", ">").gsub(/^"(.*)"$/){ "#{$1}" } %>
<% end %>