From c9d313dc2274007a3457cabd7b627e661d7383cb Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Sat, 22 Dec 2007 02:15:59 +0000 Subject: Request profiler resets after warmup and each run so you don't have to do it in your session script. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8475 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/lib/action_controller/request_profiler.rb | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'actionpack/lib/action_controller/request_profiler.rb') diff --git a/actionpack/lib/action_controller/request_profiler.rb b/actionpack/lib/action_controller/request_profiler.rb index f33cbf49e8..3dcbddd49b 100755 --- a/actionpack/lib/action_controller/request_profiler.rb +++ b/actionpack/lib/action_controller/request_profiler.rb @@ -23,8 +23,8 @@ module ActionController result = Benchmark.realtime do n.times do |i| run - print i % 10 == 0 ? 'x' : '.' - $stdout.flush + reset! + print_progress(i) end end puts @@ -42,6 +42,13 @@ module ActionController script = File.read(script_path) instance_eval "def run; #{script}; end", script_path, 1 end + + def print_progress(i) + print "\n " if i % 60 == 0 + print ' ' if i % 10 == 0 + print '.' + $stdout.flush + end end @@ -87,7 +94,10 @@ module ActionController end def warmup(sandbox) - Benchmark.realtime { sandbox.run } + Benchmark.realtime do + sandbox.run + sandbox.reset! + end end def default_options -- cgit v1.2.3