[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Server response time

jakattack2

10/27/2006 2:35:00 AM

Hello,

I just started using SugarCRM an online CRM tool. I noticed that at
the bottom of the page it would print out the following line for every
page

Server response time: 0.315068 seconds.

Is there a way to do the same in Ruby on Rails?

Janak

1 Answer

Wilson Bilkovich

10/27/2006 2:51:00 AM

0

On 10/26/06, jakattack2@gmail.com <jakattack2@gmail.com> wrote:
> Hello,
>
> I just started using SugarCRM an online CRM tool. I noticed that at
> the bottom of the page it would print out the following line for every
> page
>
> Server response time: 0.315068 seconds.
>
> Is there a way to do the same in Ruby on Rails?

Check out perform_action_with_benchmark in
actionpack/lib/action_controller/benchmarking.rb

It contains a line of code like this:
runtime = [Benchmark::measure{ perform_action_without_benchmark
}.real, 0.0001].max

You could add a line of code there that saved runtime to an instance
variable, and put it in the ActionController scope, so that you could
display it to the user. By default, it only goes to the log file.