diff options
author | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-06-02 00:08:25 +0000 |
---|---|---|
committer | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-06-02 00:08:25 +0000 |
commit | cb1affb47890013d653d4ec50fe3f042abc286c6 () | |
tree | 2682c9b9ff58dc32ad0fad583f555a66ca7ed033 /lib/benchmark.rb | |
parent | fd4ec2bc905d945648f1ea18d68f52d13dffa73d (diff) |
lib/benchmark.rb: just use Process::CLOCK_MONOTONIC
Assume Process::CLOCK_MONOTONIC exists (possibly emulated) and there is no need to bloat our code by defining a compatibility constant. * lib/benchmark.rb: just use Process::CLOCK_MONOTONIC [ruby-core:69390] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50724 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | lib/benchmark.rb | 17 |
1 files changed, 4 insertions, 13 deletions
@@ -270,15 +270,6 @@ module Benchmark STDOUT.sync = sync unless sync.nil? end - # :stopdoc: - case - when defined?(Process::CLOCK_MONOTONIC) - BENCHMARK_CLOCK = Process::CLOCK_MONOTONIC - else - BENCHMARK_CLOCK = Process::CLOCK_REALTIME - end - # :startdoc: - # # Returns the time used to execute the given block as a # Benchmark::Tms object. Takes +label+ option. @@ -297,9 +288,9 @@ module Benchmark # 0.220000 0.000000 0.220000 ( 0.227313) # def measure(label = "") # :yield: - t0, r0 = Process.times, Process.clock_gettime(BENCHMARK_CLOCK) yield - t1, r1 = Process.times, Process.clock_gettime(BENCHMARK_CLOCK) Benchmark::Tms.new(t1.utime - t0.utime, t1.stime - t0.stime, t1.cutime - t0.cutime, @@ -312,9 +303,9 @@ module Benchmark # Returns the elapsed real time used to execute the given block. # def realtime # :yield: - r0 = Process.clock_gettime(BENCHMARK_CLOCK) yield - Process.clock_gettime(BENCHMARK_CLOCK) - r0 end module_function :benchmark, :measure, :realtime, :bm, :bmbm |