Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

FInd slow actions in a Rails app (See related posts)

   1  
   2  # Show a list of actions sorted by time taken. Useful for finding slow actions.
   3  cat log/development.log | awk '/Completed/ { print "[" $3 "] - " $0 }' | sort -nr

Comments on this post

jrm02t posts on Aug 21, 2007 at 22:37
This is cool but doesn't sort exactly right - it only sorts by the first digit in the completion time - report actions taking in the double digits don't fall in line.

I guess that's motivation to get all actions in the single digits :)
Qaexl posts on Aug 22, 2007 at 20:34
The -n flag on the sort command sorts by numeric rather than by character. It works on my box (Linux/Gentoo)

Then again, I don't have anything beyond double digits in the test log.

This line can be added to a script, such as script/analyze_logs for convenience.

-Q

You need to create an account or log in to post comments to this site.


Click here to browse all 5545 code snippets

Related Posts