instance method
duration
Ruby on Rails 7.2.3
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 |event| @event = event end ActiveSupport::Notifications.instrument('wait') do sleep 1 end @event.duration # => 1000.138
Source
# File activesupport/lib/active_support/notifications/instrumenter.rb, line 198
def duration
@end - @time
end
Defined in activesupport/lib/active_support/notifications/instrumenter.rb line 198
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::Notifications::Event