instance method
duration
Ruby on Rails 6.1.7.10
Since v4.0.13Signature
duration()
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
Source
# File activesupport/lib/active_support/notifications/instrumenter.rb, line 115
def duration
1000.0 * (self.end - time)
end
Defined in activesupport/lib/active_support/notifications/instrumenter.rb line 115
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::Notifications::Event