Class: WBench::Benchmark

Inherits:
Object
  • Object
show all
Defined in:
lib/wbench/benchmark.rb

Class Method Summary collapse

Instance Method Summary collapse

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, options = {})
  @url = url
  @browser = Browser.new(url, options)
end

Class Method Details

.run(url, options = {}) ⇒ Object



3
4
5
# File 'lib/wbench/benchmark.rb', line 3

def self.run(url, options = {})
  new(url, options).run(options[:loops] || DEFAULT_LOOPS)
end

Instance Method Details

#run(loops) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/wbench/benchmark.rb', line 12

def run(loops)
  Results.new(@url, loops).tap do |results|
    loops.times do
      @browser.visit { results.add(app_server_results, browser_results, latency_results) }
    end
  end
end