Skip to content
Browse files

Request profiler resets after warmup and each run so you don't have t…

…o do it in your session script.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8475 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent a7027a9 commit c9d313dc2274007a3457cabd7b627e661d7383cb @jeremy jeremy committed Dec 22, 2007
Showing with 13 additions and 3 deletions.
  1. +13 −3 actionpack/lib/action_controller/request_profiler.rb
View
16 actionpack/lib/action_controller/request_profiler.rb
@@ -23,8 +23,8 @@ def benchmark(n)
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 @@ def define_run_method(script_path)
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 @@ def benchmark(sandbox)
end
def warmup(sandbox)
- Benchmark.realtime { sandbox.run }
+ Benchmark.realtime do
+ sandbox.run
+ sandbox.reset!
+ end
end
def default_options

0 comments on commit c9d313d

Please sign in to comment.
Something went wrong with that request. Please try again.