diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-09-06 17:33:11 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-09-06 17:33:11 +0000 |
commit | f86276b305b88c657f8ec9f853010d33f49907e2 (patch) | |
tree | 70290c9c2efde02749dd96842becec2ad8719b22 | |
parent | 291c667d6614ce28f85311f06ceb5f130b903be1 (diff) | |
download | rails-f86276b305b88c657f8ec9f853010d33f49907e2.tar.gz rails-f86276b305b88c657f8ec9f853010d33f49907e2.tar.bz2 rails-f86276b305b88c657f8ec9f853010d33f49907e2.zip |
Fix fragment benchmark calls and limit timings to 5 decimals
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2142 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r-- | actionpack/lib/action_controller/benchmarking.rb | 2 | ||||
-rw-r--r-- | actionpack/lib/action_controller/caching.rb | 8 | ||||
-rwxr-xr-x | activerecord/lib/active_record/base.rb | 2 |
3 files changed, 6 insertions, 6 deletions
diff --git a/actionpack/lib/action_controller/benchmarking.rb b/actionpack/lib/action_controller/benchmarking.rb index 587bc29d42..c2b4c10d73 100644 --- a/actionpack/lib/action_controller/benchmarking.rb +++ b/actionpack/lib/action_controller/benchmarking.rb @@ -27,7 +27,7 @@ module ActionController #:nodoc: if logger && logger.level == log_level result = nil seconds = Benchmark.realtime { result = use_silence ? silence { yield } : yield } - logger.add(log_level, "#{title} (#{sprintf("%f", seconds)})") + logger.add(log_level, "#{title} (#{'%.5f' % seconds})") result else yield diff --git a/actionpack/lib/action_controller/caching.rb b/actionpack/lib/action_controller/caching.rb index f866f7bd24..095fb7f2f2 100644 --- a/actionpack/lib/action_controller/caching.rb +++ b/actionpack/lib/action_controller/caching.rb @@ -283,7 +283,7 @@ module ActionController #:nodoc: return unless perform_caching key = fragment_cache_key(name) - benchmark "Cached fragment: #{key}" do + self.class.benchmark "Cached fragment: #{key}" do fragment_cache_store.write(key, content, options) end @@ -294,7 +294,7 @@ module ActionController #:nodoc: return unless perform_caching key, cache = fragment_cache_key(name), nil - benchmark "Fragment hit: #{key}" do + self.class.benchmark "Fragment read: #{key}" do cache = fragment_cache_store.read(key, options) end @@ -311,11 +311,11 @@ module ActionController #:nodoc: key = fragment_cache_key(name) if key.is_a?(Regexp) - benchmark "Expired fragments matching: #{key.source}" do + self.class.benchmark "Expired fragments matching: #{key.source}" do fragment_cache_store.delete_matched(key, options) end else - benchmark "Expired fragment: #{key}" do + self.class.benchmark "Expired fragment: #{key}" do fragment_cache_store.delete(key, options) end end diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index a6ce28685c..4aedbea322 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -720,7 +720,7 @@ module ActiveRecord #:nodoc: if logger result = nil seconds = Benchmark.realtime { result = use_silence ? silence { yield } : yield } - logger.info "#{title} (#{sprintf("%f", seconds)})" + logger.info "#{title} (#{'%.5f' % seconds)})" result else yield |