aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorJeremy Daer <jeremydaer@gmail.com>2019-04-16 18:48:31 -0700
committerGitHub <noreply@github.com>2019-04-16 18:48:31 -0700
commit7217e2d6b0f0986914e076774d1c5920e8397211 (patch)
treec90744a76b8fb71373a2dd2eef89c92b00d59b6b /activesupport/lib
parentae3cc9daa94ea3db3c1d9e4ddcac508d88caa11e (diff)
parent63790504699ff08088b0f7422eefa6514e3bfc30 (diff)
downloadrails-7217e2d6b0f0986914e076774d1c5920e8397211.tar.gz
rails-7217e2d6b0f0986914e076774d1c5920e8397211.tar.bz2
rails-7217e2d6b0f0986914e076774d1c5920e8397211.zip
Merge pull request #35984 from vishaltelangre/asn-misc-fixes
Various fixes in ActiveSupport::Notifications::Event
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/notifications/fanout.rb4
-rw-r--r--activesupport/lib/active_support/notifications/instrumenter.rb7
2 files changed, 5 insertions, 6 deletions
diff --git a/activesupport/lib/active_support/notifications/fanout.rb b/activesupport/lib/active_support/notifications/fanout.rb
index c506b35b1e..8812b67f63 100644
--- a/activesupport/lib/active_support/notifications/fanout.rb
+++ b/activesupport/lib/active_support/notifications/fanout.rb
@@ -180,13 +180,13 @@ module ActiveSupport
def start(name, id, payload)
timestack = Thread.current[:_timestack] ||= []
- timestack.push Time.now
+ timestack.push Concurrent.monotonic_time
end
def finish(name, id, payload)
timestack = Thread.current[:_timestack]
started = timestack.pop
- @delegate.call(name, started, Time.now, id, payload)
+ @delegate.call(name, started, Concurrent.monotonic_time, id, payload)
end
end
diff --git a/activesupport/lib/active_support/notifications/instrumenter.rb b/activesupport/lib/active_support/notifications/instrumenter.rb
index a03e7e483e..12546511a8 100644
--- a/activesupport/lib/active_support/notifications/instrumenter.rb
+++ b/activesupport/lib/active_support/notifications/instrumenter.rb
@@ -68,9 +68,8 @@ module ActiveSupport
@transaction_id = transaction_id
@end = ending
@children = []
- @duration = nil
- @cpu_time_start = nil
- @cpu_time_finish = nil
+ @cpu_time_start = 0
+ @cpu_time_finish = 0
@allocation_count_start = 0
@allocation_count_finish = 0
end
@@ -125,7 +124,7 @@ module ActiveSupport
#
# @event.duration # => 1000.138
def duration
- @duration ||= 1000.0 * (self.end - time)
+ 1000.0 * (self.end - time)
end
def <<(event)