forked from basecamp/action_profiler
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Require ruby-prof >= 0.7.3. Tighten rescue clause.
- Loading branch information
Showing
1 changed file
with
9 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,17 @@ | ||
begin | ||
require 'action_profiler' | ||
class ActionController::Base | ||
include ActionController::ActionProfiler | ||
logger.info "Action profiling enabled. Add around_filter :action_profiler to ApplicationController then append ?profile=process_time to any URL to profile the page load and download a calltree file. Open it with kcachegrind." | ||
end | ||
rescue LoadError | ||
gem 'ruby-prof', '>= 0.7.3' | ||
rescue Gem::LoadError | ||
class ActionController::Base | ||
def action_profiler(*args) | ||
logger.info "`gem install ruby-prof` to enable action profiling." | ||
yield | ||
end | ||
logger.info "Action profiling disabled. `gem install ruby-prof` to enable." | ||
end | ||
else | ||
require 'action_profiler' | ||
class ActionController::Base | ||
include ActionController::ActionProfiler | ||
logger.info "Action profiling enabled. Add around_filter :action_profiler to ApplicationController then append ?profile=process_time to any URL to profile the page load and download a calltree file. Open it with kcachegrind." | ||
end | ||
end |