benchmark.rb: Process::CLOCK_MONOTONIC_RAW may be unavailable

* lib/benchmark.rb (BENCHMARK_CLOCK): Process::CLOCK_MONOTONIC_RAW
  is not supported on old linux.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47330 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2014-08-31 06:05:43 +00:00
parent d723b93038
commit cf990c5ace

View File

@ -272,7 +272,8 @@ module Benchmark
# :stopdoc:
case
when defined?(Process::CLOCK_MONOTONIC_RAW)
when defined?(Process::CLOCK_MONOTONIC_RAW) and
(Process.clock_gettime(Process::CLOCK_MONOTONIC_RAW) rescue false)
BENCHMARK_CLOCK = Process::CLOCK_MONOTONIC_RAW
when defined?(Process::CLOCK_MONOTONIC)
BENCHMARK_CLOCK = Process::CLOCK_MONOTONIC