End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
class method
Benchmark.realtime
realtime() { || ... }
lib/benchmark.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.1.3/lib/benchmark.rb, line 309
def realtime # :yield:
r0 = Process.clock_gettime(Process::CLOCK_MONOTONIC)
yield
Process.clock_gettime(Process::CLOCK_MONOTONIC) - r0
end
Returns the elapsed real time used to execute the given block.