提交 e07f3ddc 编写于 作者: C claudiob

Add docs for AS::Notifications::Event#duration

[ci skip]
上级 2ed2be1c
......@@ -57,6 +57,18 @@ def initialize(name, start, ending, transaction_id, payload)
@duration = nil
end
# Returns the difference in milliseconds between the moments when the
# execution of the instrumented 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
def duration
@duration ||= 1000.0 * (self.end - time)
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册