diff options
author | タコ焼き仮面 <takoyakikamen0@gmail.com> | 2012-06-18 16:34:23 -0700 |
---|---|---|
committer | タコ焼き仮面 <takoyakikamen0@gmail.com> | 2012-06-18 16:34:23 -0700 |
commit | c6d86a5db4b115783675c23900ddb292a44d99cc (patch) | |
tree | dec34597b5974a592a18d0c0aa5a8457fff51e17 /activesupport/lib/active_support/notifications | |
parent | 7fe0f27e2b97a2f175b31b97d14f92473688f66a (diff) | |
download | rails-c6d86a5db4b115783675c23900ddb292a44d99cc.tar.gz rails-c6d86a5db4b115783675c23900ddb292a44d99cc.tar.bz2 rails-c6d86a5db4b115783675c23900ddb292a44d99cc.zip |
make events not use date and time to determine parent_of. fixes #5932
Diffstat (limited to 'activesupport/lib/active_support/notifications')
-rw-r--r-- | activesupport/lib/active_support/notifications/instrumenter.rb | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/activesupport/lib/active_support/notifications/instrumenter.rb b/activesupport/lib/active_support/notifications/instrumenter.rb index 58e292c658..7dfea4bb4b 100644 --- a/activesupport/lib/active_support/notifications/instrumenter.rb +++ b/activesupport/lib/active_support/notifications/instrumenter.rb @@ -31,7 +31,8 @@ module ActiveSupport end class Event - attr_reader :name, :time, :end, :transaction_id, :payload, :duration + attr_reader :name, :time, :transaction_id, :payload, :children + attr_accessor :end def initialize(name, start, ending, transaction_id, payload) @name = name @@ -39,12 +40,19 @@ module ActiveSupport @time = start @transaction_id = transaction_id @end = ending - @duration = 1000.0 * (@end - @time) + @children = [] + end + + def duration + 1000.0 * (self.end - time) + end + + def <<(event) + @children << event end def parent_of?(event) - start = (time - event.time) * 1000 - start <= 0 && (start + duration >= event.duration) + @children.include? event end end end |