aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/subscriber.rb
diff options
context:
space:
mode:
authorAaron Patterson <tenderlove@github.com>2018-07-26 11:45:31 -0700
committerGitHub <noreply@github.com>2018-07-26 11:45:31 -0700
commitf0c917c7d491f4f7b142748375e1128d5579152a (patch)
treedc0933afa79eb8092ea609729b5b63d067ea4c02 /activesupport/lib/active_support/subscriber.rb
parent5f92e43af1ba1413b40d25c99741812a103e02b8 (diff)
parent42fec4b8de8c40d7778f936e200081c0dded1ed0 (diff)
downloadrails-f0c917c7d491f4f7b142748375e1128d5579152a.tar.gz
rails-f0c917c7d491f4f7b142748375e1128d5579152a.tar.bz2
rails-f0c917c7d491f4f7b142748375e1128d5579152a.zip
Merge pull request #33449 from rails/use-process-clock-instead-of-time
Add cpu time, idle time, and allocations features to log subscriber events
Diffstat (limited to 'activesupport/lib/active_support/subscriber.rb')
-rw-r--r--activesupport/lib/active_support/subscriber.rb7
1 files changed, 3 insertions, 4 deletions
diff --git a/activesupport/lib/active_support/subscriber.rb b/activesupport/lib/active_support/subscriber.rb
index 8ad39f7a05..54c770ac35 100644
--- a/activesupport/lib/active_support/subscriber.rb
+++ b/activesupport/lib/active_support/subscriber.rb
@@ -79,7 +79,8 @@ module ActiveSupport
end
def start(name, id, payload)
- e = ActiveSupport::Notifications::Event.new(name, Time.now, nil, id, payload)
+ e = ActiveSupport::Notifications::Event.new(name, nil, nil, id, payload)
+ e.start!
parent = event_stack.last
parent << e if parent
@@ -87,9 +88,8 @@ module ActiveSupport
end
def finish(name, id, payload)
- finished = Time.now
event = event_stack.pop
- event.end = finished
+ event.finish!
event.payload.merge!(payload)
method = name.split(".".freeze).first
@@ -97,7 +97,6 @@ module ActiveSupport
end
private
-
def event_stack
SubscriberQueueRegistry.instance.get_queue(@queue_key)
end