method

realtime

rails latest stable - Class: ActiveSupport::Benchmark

Method not available on this version

This method is only available on newer versions. The first available version (v8.0.0) is shown here.

realtime(unit = :float_second, &block)
public

Benchmark realtime in the specified time unit. By default, the returned unit is in seconds.

ActiveSupport::Benchmark.realtime { sleep 0.1 }
# => 0.10007

ActiveSupport::Benchmark.realtime(:float_millisecond) { sleep 0.1 }
# => 100.07

`unit` can be any of the values accepted by Ruby’s `Process.clock_gettime`.