aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorMichael Koziarski <michael@koziarski.com>2008-02-02 01:53:58 +0000
committerMichael Koziarski <michael@koziarski.com>2008-02-02 01:53:58 +0000
commit95af46861a80463833081c049f3a723e90c7ec01 (patch)
treed4c9a7dbbb2c646e9946422033ba1cb90de3cd59 /activesupport
parent6d39d05269fa0f07ab86195e8a09320f63ac9dbb (diff)
downloadrails-95af46861a80463833081c049f3a723e90c7ec01.tar.gz
rails-95af46861a80463833081c049f3a723e90c7ec01.tar.bz2
rails-95af46861a80463833081c049f3a723e90c7ec01.zip
Simplified, faster implementation of Benchmark.realtime [Alexander Dymo]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8771 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/core_ext/benchmark.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/core_ext/benchmark.rb b/activesupport/lib/active_support/core_ext/benchmark.rb
new file mode 100644
index 0000000000..98e61e646a
--- /dev/null
+++ b/activesupport/lib/active_support/core_ext/benchmark.rb
@@ -0,0 +1,12 @@
+require 'benchmark'
+
+module Benchmark
+ remove_method :realtime
+ def realtime
+ r0 = Time.now
+ yield
+ r1 = Time.now
+ r1.to_f - r0.to_f
+ end
+ module_function :realtime
+end \ No newline at end of file