Skip to content

Instantly share code, notes, and snippets.

@tomlea
Created December 2, 2008 17:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomlea/31197 to your computer and use it in GitHub Desktop.
Save tomlea/31197 to your computer and use it in GitHub Desktop.
Script to parse rails logs and summarise total partial rendering times.
data = Hash.new(0)
while line = gets
if m = line.match(/Rendered (\S+) \(([\d\.]+)\)/)
data[m[1]] += m[2].to_f
end
if line =~ /Completed/
data.sort_by{ |name, value| value }.each do |name, value|
puts "%.04f : #{name}" % value
end
puts line, ""
data.clear
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment