class Exactly
Represents a benchmarking helper that executes a block a fixed number of times.
Definitions
def initialize(sampler, count)
Initializes a new class Sus::Fixtures::Benchmark::Repeats::Exactly
object with a sampler and a fixed count.
Signature
-
parameter
sampler
Sampler
The sampler object to collect timing data.
-
parameter
count
Integer
The exact number of times to execute the block.
Implementation
def initialize(sampler, count)
@sampler = sampler
@count = count
end
attr :sampler
Signature
-
attribute
Sampler
The sampler that collects timing data.
attr :count
Signature
-
attribute
Integer
The number of times to execute the block.
def times(&block)
Executes the block exactly the specified number of times.
Signature
-
parameter
block
Proc
The block to benchmark.
Implementation
def times(&block)
@count.times do
sample!(block)
end
end