diff options
author | Gannon McGibbon <gannon.mcgibbon@gmail.com> | 2018-11-08 10:59:52 -0500 |
---|---|---|
committer | Gannon McGibbon <gannon.mcgibbon@gmail.com> | 2018-11-08 12:07:21 -0500 |
commit | 0712dfd6ae1423269af1512c3403ee1145f27de1 (patch) | |
tree | 80daa81c448df725c12aba55e3e2d8bb28066da0 /activesupport/lib/active_support/notifications | |
parent | fc2684c9c012b95ce003cce22b378d5ea9ab56d3 (diff) | |
download | rails-0712dfd6ae1423269af1512c3403ee1145f27de1.tar.gz rails-0712dfd6ae1423269af1512c3403ee1145f27de1.tar.bz2 rails-0712dfd6ae1423269af1512c3403ee1145f27de1.zip |
Windows support for parallelization and instrumenter
Add Windows support for `ActiveSupport::Testing::Parallelization`
and `ActiveSupport::Notifications::Instrumenter`.
Diffstat (limited to 'activesupport/lib/active_support/notifications')
-rw-r--r-- | activesupport/lib/active_support/notifications/instrumenter.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/notifications/instrumenter.rb b/activesupport/lib/active_support/notifications/instrumenter.rb index f8344912bb..9184f8f54b 100644 --- a/activesupport/lib/active_support/notifications/instrumenter.rb +++ b/activesupport/lib/active_support/notifications/instrumenter.rb @@ -55,6 +55,11 @@ module ActiveSupport attr_reader :name, :time, :transaction_id, :payload, :children attr_accessor :end + def self.clock_gettime_supported? # :nodoc: + defined?(Process::CLOCK_PROCESS_CPUTIME_ID) && + !Gem.win_platform? + end + def initialize(name, start, ending, transaction_id, payload) @name = name @payload = payload.dup @@ -130,7 +135,7 @@ module ActiveSupport Process.clock_gettime(Process::CLOCK_MONOTONIC) end - if defined?(Process::CLOCK_PROCESS_CPUTIME_ID) + if clock_gettime_supported? def now_cpu Process.clock_gettime(Process::CLOCK_PROCESS_CPUTIME_ID) end |