class ActiveSupport::Notifications::Event

def duration

@event.duration # => 1000.138

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

end
@event = event
ActiveSupport::Notifications.subscribe('wait') do |event|

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