Alternatively, I can write a bunch of Time.now
and print out the subtractions but is there a standard way it can be done by gems or by Rails' standard and conventional method?
views:
32answers:
2
A:
You could add a statment on the top/end of your application.html.erb?
# application_controller.rb
class ApplicationController < ActionController::Base
before_filter :set_start_timer
def set_start_timer
@start_time = Time.now
end
end
# application.html.haml
=@start_time # this is the overall processing time
=Time.now # this is the start view render time
=yield
=Time.now # this is the view render time after processing content
Lichtamberg
2010-09-16 22:59:47
isn't that what i said in the original post?
動靜能量
2010-09-16 23:20:06
If you insert it into your application.html.erb you only have to write 2 single statements at all.
Lichtamberg
2010-09-17 21:33:00
and then modify `ApplicationController` to also do a `@time_start = Time.now`?
動靜能量
2010-09-21 00:49:38
Updated my post...
Lichtamberg
2010-09-21 11:57:48
+2
A:
You might want to take a look at Railscast 98 and 161.
I've used NewRelic's hosted plan and it's definitely a great tool if the basic plan meets your needs or you can afford a paid plan. I haven't played around with the developer mode yet but it looks pretty good, especially for being free. Rack::Bug look nice too I might just have to take it for a spin.
aNoble
2010-09-17 06:14:11
+1. I'm also using NewRelic RPM for such tasks, developer mode works just fine. However, free version doesn't show you the time in controller vs the view, only the time in Ruby vs Database vs External services. Still, it's enough to find performance bottlenecks in most cases.
buru
2010-09-17 10:48:47