Class: WBench::Benchmark
- Inherits:
-
Object
- Object
- WBench::Benchmark
- Defined in:
- lib/wbench/benchmark.rb
Class Method Summary collapse
Instance Method Summary collapse
- #before_each(&blk) ⇒ Object
-
#initialize(url, options = {}) ⇒ Benchmark
constructor
A new instance of Benchmark.
- #run(loops) ⇒ Object
Constructor Details
#initialize(url, options = {}) ⇒ Benchmark
Returns a new instance of Benchmark.
7 8 9 10 |
# File 'lib/wbench/benchmark.rb', line 7 def initialize(url, = {}) @url = url @browser = Browser.new(url, ) end |
Class Method Details
.run(url, options = {}) ⇒ Object
3 4 5 |
# File 'lib/wbench/benchmark.rb', line 3 def self.run(url, = {}) new(url, ).run([:loops] || DEFAULT_LOOPS) end |
Instance Method Details
#before_each(&blk) ⇒ Object
12 13 14 |
# File 'lib/wbench/benchmark.rb', line 12 def before_each(&blk) @before_each = blk end |
#run(loops) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/wbench/benchmark.rb', line 16 def run(loops) Results.new(@url, loops).tap do |results| loops.times do @browser.run(&@before_each) @browser.visit { results.add(app_server_results, browser_results, latency_results) } end end end |