diff options
author | Vijay Dev <vijaydev.cse@gmail.com> | 2014-12-20 14:26:21 +0000 |
---|---|---|
committer | Vijay Dev <vijaydev.cse@gmail.com> | 2014-12-20 14:26:21 +0000 |
commit | 15590c1a2a76b6560840cfa55c5a2485b4566460 (patch) | |
tree | 66c08538f97e39caf48559f603c578df044d4a4d /activesupport/lib/active_support/notifications/instrumenter.rb | |
parent | a8015865d24c5cd4551c3be06abd8211f79888ea (diff) | |
parent | 78ae8eebe5c7cfef114d1e6266a8b3d198545d2a (diff) | |
download | rails-15590c1a2a76b6560840cfa55c5a2485b4566460.tar.gz rails-15590c1a2a76b6560840cfa55c5a2485b4566460.tar.bz2 rails-15590c1a2a76b6560840cfa55c5a2485b4566460.zip |
Merge branch 'master' of github.com:rails/docrails
Diffstat (limited to 'activesupport/lib/active_support/notifications/instrumenter.rb')
-rw-r--r-- | activesupport/lib/active_support/notifications/instrumenter.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/notifications/instrumenter.rb b/activesupport/lib/active_support/notifications/instrumenter.rb index 3a244b34b5..075ddc2382 100644 --- a/activesupport/lib/active_support/notifications/instrumenter.rb +++ b/activesupport/lib/active_support/notifications/instrumenter.rb @@ -57,6 +57,18 @@ module ActiveSupport @duration = nil end + # Returns the difference in milliseconds between when the execution of the + # event started and when it ended. + # + # ActiveSupport::Notifications.subscribe('wait') do |*args| + # @event = ActiveSupport::Notifications::Event.new(*args) + # end + # + # ActiveSupport::Notifications.instrument('wait') do + # sleep 1 + # end + # + # @event.duration # => 1000.138 def duration @duration ||= 1000.0 * (self.end - time) end |