diff options
author | José Valim <jose.valim@gmail.com> | 2010-07-20 17:07:18 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-07-20 17:07:18 +0200 |
commit | 9df9c4bac008ba94c37faff411368c33408faff8 (patch) | |
tree | 4aef79e09a0c98843132a5a8a1dae61c19d7b13e /activesupport/lib/active_support | |
parent | 51d2db0a63529cfe6e7d7d0c620f10235c63ffe4 (diff) | |
download | rails-9df9c4bac008ba94c37faff411368c33408faff8.tar.gz rails-9df9c4bac008ba94c37faff411368c33408faff8.tar.bz2 rails-9df9c4bac008ba94c37faff411368c33408faff8.zip |
Add a test for elapsed and require missing benchmark file.
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r-- | activesupport/lib/active_support/notifications/instrumenter.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/notifications/instrumenter.rb b/activesupport/lib/active_support/notifications/instrumenter.rb index ff2b19bc65..e98189f899 100644 --- a/activesupport/lib/active_support/notifications/instrumenter.rb +++ b/activesupport/lib/active_support/notifications/instrumenter.rb @@ -17,8 +17,8 @@ module ActiveSupport # and publish it. Notice that events get sent even if an error occurs # in the passed-in block def instrument(name, payload={}) - @started = Time.now begin + @started = Time.now yield(payload) if block_given? rescue Exception => e payload[:exception] = [e.class.name, e.message] @@ -30,7 +30,7 @@ module ActiveSupport end def elapsed - 1000.0 * @finished.to_f - @started.to_f + 1000.0 * (@finished.to_f - @started.to_f) end private |