Skip to content

Instantly share code, notes, and snippets.

@boxofrad
Created August 13, 2013 08:48
Show Gist options
  • Save boxofrad/6219171 to your computer and use it in GitHub Desktop.
Save boxofrad/6219171 to your computer and use it in GitHub Desktop.
Handy controller profiling code
around_filter :profile
def profile
if params[:profile] && result = RubyProf.profile { yield }
out = StringIO.new
RubyProf::GraphHtmlPrinter.new(result).print out, :min_percent => 0
self.response_body = out.string
else
yield
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment