From 9df9c4bac008ba94c37faff411368c33408faff8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Tue, 20 Jul 2010 17:07:18 +0200 Subject: Add a test for elapsed and require missing benchmark file. --- activesupport/lib/active_support/notifications/instrumenter.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'activesupport/lib/active_support/notifications') 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 -- cgit v1.2.3