Topic: Profiling an action / request?
Can anyone give me advice on how to profile an entire action / page load in Rails 2.3.5 under Ruby 1.8.7? I've been beating my head against the internets trying to figure this out.
The guide to Performance Testing Rails Applications looks interesting, with rake test:profile and rake test:benchmark. However, getting any useful statistics out of these requires "GC patched Ruby". Unfortunately the GC patch is badly out of date, it is only available for Ruby 1.8.6 not 1.8.7 or 1.9. A couple of my plugins break under 1.8.6, so that's a no-go.
Moving on, I discover the interesting Railscast about the script/performance/request tool ... only to discover that it's been silently removed from Rails as of 2.3.2. I don't want script/performance/profile, because it looks like that only lets me profile a single method call ... I really need to profile the entire request.
So then there's the replacement request_profiler plugin at http://github.com/rails/request_profiler. It looks like it's supposed to extend script/performance/profiler to let you profile entire actions. Unfortunately, this doesn't work for me. I install it, create a very simple profile script in lib/profile_script.rb as per the example, and run it. I get this:
[09:54:56 MyProject (profiling)]$ script/performance/profiler lib/profile_script.rb Loading Rails... Using the ruby-prof extension. (eval):1:in `profile_me': undefined local variable or method `lib' for main:Object (NameError) from /Users/evan/Development/Ruby/CITAlumni/vendor/rails/railties/lib/commands/performance/profiler.rb:24 from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' from script/performance/profiler:3
Any thoughts? It really shouldn't be this hard to get a simple profile so I know where time is being wasted in my application.