Skip to content

Instantly share code, notes, and snippets.

@ashgti
Created December 15, 2008 18:01
Show Gist options
  • Save ashgti/36025 to your computer and use it in GitHub Desktop.
Save ashgti/36025 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'ruby-prof'
# Add the local gems dir if found within the app root; any dependencies loaded
# hereafter will try to load from the local gems before loading system gems.
if (local_gem_dir = File.join(File.dirname(__FILE__), '..', 'gems')) && $BUNDLE.nil?
$BUNDLE = true; Gem.clear_paths; Gem.path.unshift(local_gem_dir)
end
require "merb-core"
# this loads all plugins required in your init file so don't add them
# here again, Merb will do it for you
Merb.start_environment(:testing => true, :adapter => 'runner', :environment => ENV['MERB_ENV'] || 'test')
include(Merb::Test::ViewHelper)
include(Merb::Test::RouteHelper)
include(Merb::Test::ControllerHelper)
result = RubyProf.profile do
request('/')
end
# Print a graph profile to text
printer = RubyProf::CallTreePrinter.new(result)
printer.print(STDOUT, 0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment