module Benchmark::Perf

Constants

VERSION

Public Class Methods

cpu(**options, &work) click to toggle source

Measure execution time(a.k.a cpu time) of a given work

@example

Benchmark::Perf.cpu { "foo" + "bar" }

@param [Numeric] time

the time to run measurements in seconds

@param [Numeric] warmup

the warmup time in seconds

@param [Integer] repeat

how many times to repeat measurements

@return [Array[Float, Float]]

@api public

# File lib/benchmark/perf.rb, line 43
def cpu(**options, &work)
  Execution.run(**options, &work)
end
ips(**options, &work) click to toggle source

Measure iterations a work could take in a second

@example

Benchmark::Perf.ips { "foo" + "bar" }

@param [Numeric] time

the time to run measurements in seconds

@param [Numeric] warmup

the warmup time in seconds

@return [Array[Integer, Integer, Integer, Float]]

the average, standard deviation, iterations and time

@api public

# File lib/benchmark/perf.rb, line 23
def ips(**options, &work)
  Iteration.run(**options, &work)
end

Private Instance Methods

cpu(**options, &work) click to toggle source

Measure execution time(a.k.a cpu time) of a given work

@example

Benchmark::Perf.cpu { "foo" + "bar" }

@param [Numeric] time

the time to run measurements in seconds

@param [Numeric] warmup

the warmup time in seconds

@param [Integer] repeat

how many times to repeat measurements

@return [Array[Float, Float]]

@api public

# File lib/benchmark/perf.rb, line 43
def cpu(**options, &work)
  Execution.run(**options, &work)
end
ips(**options, &work) click to toggle source

Measure iterations a work could take in a second

@example

Benchmark::Perf.ips { "foo" + "bar" }

@param [Numeric] time

the time to run measurements in seconds

@param [Numeric] warmup

the warmup time in seconds

@return [Array[Integer, Integer, Integer, Float]]

the average, standard deviation, iterations and time

@api public

# File lib/benchmark/perf.rb, line 23
def ips(**options, &work)
  Iteration.run(**options, &work)
end