Class: BME::Suite
- Inherits:
-
Object
- Object
- BME::Suite
- Defined in:
- lib/bme.rb
Defined Under Namespace
Classes: DuplicateBenchmark
Instance Method Summary collapse
-
#initialize(iterations) ⇒ Suite
constructor
A new instance of Suite.
- #report(name, options = {}, &block) ⇒ Object
- #run ⇒ Object
Constructor Details
#initialize(iterations) ⇒ Suite
Returns a new instance of Suite.
18 19 20 21 |
# File 'lib/bme.rb', line 18 def initialize(iterations) @iterations = iterations @benchmarks = [] end |
Instance Method Details
#report(name, options = {}, &block) ⇒ Object
23 24 25 |
# File 'lib/bme.rb', line 23 def report(name, = {}, &block) add_benchmark(name, , &block) end |
#run ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/bme.rb', line 27 def run adjust_benchmark_names! Benchmark.bm do |bench| @benchmarks.each do |name, , block| bench.report(name) do ([:iterations] || @iterations).times { block.call } end end end end |