Sha256: 61a1ea23aadd4e0dcb2322204b8ee6e1b683c65af9f4af8be605a5ff21e9eec7

Contents?: true

Size: 477 Bytes

Versions: 2

Compression:

Stored size: 477 Bytes

Contents

require "benchmark"

module RBM
  class Benchmarker
    DEFAULT_OPTIONS = {
      :times => 1
    }

    attr_reader :fragments, :options

    def initialize(fragments, options = {})
      @fragments = fragments
      @options = self.class::DEFAULT_OPTIONS.merge(options)
    end

    def run
      Benchmark.bmbm do |bm|
        fragments.each do |fragment|
          fragment.run(bm, options[:times], options[:init], options[:cleanup])
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rbm-1.0.1 lib/rbm/benchmarker.rb
rbm-1.0.0 lib/rbm/benchmarker.rb