aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/request_profiler.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2008-12-09 11:17:11 -0800
committerJeremy Kemper <jeremy@bitsweat.net>2008-12-09 11:17:11 -0800
commite8c4939fb3366472021c1af1331bfdfe5d7a5d75 (patch)
tree0f1d9e20cb5a0e30820f6ccc8e9dd735e3273f1f /actionpack/lib/action_controller/request_profiler.rb
parentc3fe6ebbfaedff8d6dd8f590bdd237fac174faac (diff)
downloadrails-e8c4939fb3366472021c1af1331bfdfe5d7a5d75.tar.gz
rails-e8c4939fb3366472021c1af1331bfdfe5d7a5d75.tar.bz2
rails-e8c4939fb3366472021c1af1331bfdfe5d7a5d75.zip
Benchmark.ms
Diffstat (limited to 'actionpack/lib/action_controller/request_profiler.rb')
-rw-r--r--actionpack/lib/action_controller/request_profiler.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/actionpack/lib/action_controller/request_profiler.rb b/actionpack/lib/action_controller/request_profiler.rb
index 70bb77e7ac..80cd55334f 100644
--- a/actionpack/lib/action_controller/request_profiler.rb
+++ b/actionpack/lib/action_controller/request_profiler.rb
@@ -20,7 +20,7 @@ module ActionController
@quiet = true
print ' '
- result = Benchmark.realtime do
+ ms = Benchmark.ms do
n.times do |i|
run(profiling)
print_progress(i)
@@ -28,7 +28,7 @@ module ActionController
end
puts
- result
+ ms
ensure
@quiet = false
end
@@ -88,7 +88,7 @@ module ActionController
puts 'Warming up once'
elapsed = warmup(sandbox)
- puts '%.2f sec, %d requests, %d req/sec' % [elapsed, sandbox.request_count, sandbox.request_count / elapsed]
+ puts '%.0f ms, %d requests, %d req/sec' % [elapsed, sandbox.request_count, 1000 * sandbox.request_count / elapsed]
puts "\n#{options[:benchmark] ? 'Benchmarking' : 'Profiling'} #{options[:n]}x"
options[:benchmark] ? benchmark(sandbox) : profile(sandbox)
@@ -106,13 +106,13 @@ module ActionController
def benchmark(sandbox, profiling = false)
sandbox.request_count = 0
- elapsed = sandbox.benchmark(options[:n], profiling).to_f
+ elapsed = sandbox.benchmark(options[:n], profiling)
count = sandbox.request_count.to_i
- puts '%.2f sec, %d requests, %d req/sec' % [elapsed, count, count / elapsed]
+ puts '%.0f ms, %d requests, %d req/sec' % [elapsed, count, 1000 * count / elapsed]
end
def warmup(sandbox)
- Benchmark.realtime { sandbox.run(false) }
+ Benchmark.ms { sandbox.run(false) }
end
def default_options