Skip to content

Instantly share code, notes, and snippets.

@minad
Last active August 29, 2015 14:05
Show Gist options
  • Save minad/5a041839cc5aa76c1522 to your computer and use it in GitHub Desktop.
Save minad/5a041839cc5aa76c1522 to your computer and use it in GitHub Desktop.
ruby profile block
def profile(&b)
require 'ruby-prof'
printer = RubyProf::FlatPrinter.new(RubyProf.profile(&b))
File.open('/tmp/profile.txt', 'w') {|f| printer.print(f) }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment