Class: RBM::Benchmarker
- Inherits:
-
Object
- Object
- RBM::Benchmarker
- Defined in:
- lib/rbm/benchmarker.rb
Constant Summary collapse
- DEFAULT_OPTIONS =
{ :times => 1 }
Instance Attribute Summary collapse
-
#fragments ⇒ Object
readonly
Returns the value of attribute fragments.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(fragments, options = {}) ⇒ Benchmarker
constructor
A new instance of Benchmarker.
- #run ⇒ Object
Constructor Details
#initialize(fragments, options = {}) ⇒ Benchmarker
Returns a new instance of Benchmarker.
11 12 13 14 |
# File 'lib/rbm/benchmarker.rb', line 11 def initialize(fragments, = {}) @fragments = fragments @options = self.class::DEFAULT_OPTIONS.merge() end |
Instance Attribute Details
#fragments ⇒ Object (readonly)
Returns the value of attribute fragments.
9 10 11 |
# File 'lib/rbm/benchmarker.rb', line 9 def fragments @fragments end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
9 10 11 |
# File 'lib/rbm/benchmarker.rb', line 9 def @options end |
Instance Method Details
#run ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/rbm/benchmarker.rb', line 16 def run Benchmark.bmbm do |bm| fragments.each do |fragment| fragment.run(bm, [:times], [:init], [:cleanup]) end end end |