aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/notifications/instrumenter.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/notifications/instrumenter.rb b/activesupport/lib/active_support/notifications/instrumenter.rb
index 455b7a44a6..f8344912bb 100644
--- a/activesupport/lib/active_support/notifications/instrumenter.rb
+++ b/activesupport/lib/active_support/notifications/instrumenter.rb
@@ -130,8 +130,14 @@ module ActiveSupport
Process.clock_gettime(Process::CLOCK_MONOTONIC)
end
- def now_cpu
- Process.clock_gettime(Process::CLOCK_PROCESS_CPUTIME_ID)
+ if defined?(Process::CLOCK_PROCESS_CPUTIME_ID)
+ def now_cpu
+ Process.clock_gettime(Process::CLOCK_PROCESS_CPUTIME_ID)
+ end
+ else
+ def now_cpu
+ 0
+ end
end
if defined?(JRUBY_VERSION)