instance method
duration
Ruby on Rails 7.1.6
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 205
def duration
@end - @time
end
Defined in activesupport/lib/active_support/notifications/instrumenter.rb line 205
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::Notifications::Event