class ActiveSupport::Notifications::Event

def duration

@event.duration # => 1000.138

end
sleep 1
ActiveSupport::Notifications.instrument('wait') do

end
@event = ActiveSupport::Notifications::Event.new(*args)
ActiveSupport::Notifications.subscribe('wait') do |*args|

event started and when it ended.
Returns the difference in milliseconds between when the execution of the
def duration
  self.end - time
end