module Benchmark
def measure(label = "") # :yield:
0.220000 0.000000 0.220000 ( 0.227313)
Generates:
puts time
end
n.times { a = "1" }
time = Benchmark.measure do
n = 1000000
require 'benchmark'
Benchmark::Tms object. Takes +label+ option.
Returns the time used to execute the given block as a
def measure(label = "") # :yield: t0, r0 = Process.times, Process.clock_gettime(Process::CLOCK_MONOTONIC) yield t1, r1 = Process.times, Process.clock_gettime(Process::CLOCK_MONOTONIC) Benchmark::Tms.new(t1.utime - t0.utime, t1.stime - t0.stime, t1.cutime - t0.cutime, t1.cstime - t0.cstime, r1 - r0, label) end