Class: Benchmark::Avg::BenchmarkSuite
- Inherits:
-
Object
- Object
- Benchmark::Avg::BenchmarkSuite
- Defined in:
- lib/benchmark/avg/benchmark_suite.rb
Instance Method Summary collapse
- #config(options) ⇒ Object
-
#initialize ⇒ BenchmarkSuite
constructor
A new instance of BenchmarkSuite.
- #report(label = "", &block) ⇒ Object
- #run ⇒ Object
Constructor Details
#initialize ⇒ BenchmarkSuite
12 13 14 15 |
# File 'lib/benchmark/avg/benchmark_suite.rb', line 12 def initialize = @jobs = [] end |
Instance Method Details
#config(options) ⇒ Object
17 18 19 |
# File 'lib/benchmark/avg/benchmark_suite.rb', line 17 def config() .merge! end |
#report(label = "", &block) ⇒ Object
21 22 23 24 |
# File 'lib/benchmark/avg/benchmark_suite.rb', line 21 def report(label = "", &block) @jobs << Job.new(label, block) self end |
#run ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/benchmark/avg/benchmark_suite.rb', line 26 def run puts 'Running your benchmark...' divider each_job { |job| job.run [:warmup], [:time] } puts 'Benchmarking finished, here are your reports...' puts puts 'Warm up results:' divider each_job { |job| puts job.warmup_report } puts puts 'Runtime results:' divider each_job { |job| puts job.runtime_report } divider end |