diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2007-12-22 02:15:59 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2007-12-22 02:15:59 +0000 |
commit | c9d313dc2274007a3457cabd7b627e661d7383cb (patch) | |
tree | 1f53e252698275d357bc789fc7b740461ea4950f /actionpack/lib/action_controller | |
parent | a7027a94d461167e4d206457447afa73c16a7156 (diff) | |
download | rails-c9d313dc2274007a3457cabd7b627e661d7383cb.tar.gz rails-c9d313dc2274007a3457cabd7b627e661d7383cb.tar.bz2 rails-c9d313dc2274007a3457cabd7b627e661d7383cb.zip |
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
Diffstat (limited to 'actionpack/lib/action_controller')
-rwxr-xr-x | actionpack/lib/action_controller/request_profiler.rb | 16 |
1 files changed, 13 insertions, 3 deletions
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 |