Skip to content

Commit

Permalink
Request profiler resets after warmup and each run so you don't have t…
Browse files Browse the repository at this point in the history
…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
jeremy committed Dec 22, 2007
1 parent a7027a9 commit c9d313d
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions actionpack/lib/action_controller/request_profiler.rb
Expand Up @@ -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
Expand All @@ -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


Expand Down Expand Up @@ -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
Expand Down

0 comments on commit c9d313d

Please sign in to comment.