Initizalizes a new benchmark
# File lib/bigbench/benchmark.rb, line 36 def initialize(name, url, options, &block) @name, @uri, @tracker, @is_running, @runs = name, URI(url), Tracker::Tracker.new, false, 0 @users = options[:users] || BigBench.config.users @duration = options[:duration] || BigBench.config.duration @fragments = BigBench::Fragment.parse(self, &block) end
Returns if this benchmark is currently running
# File lib/bigbench/benchmark.rb, line 56 def is_running? @is_running end
Execute this benchmark
# File lib/bigbench/benchmark.rb, line 44 def run! # Setup Timer timer = Thread.new{ sleep(@duration); @is_running = false } @start, @is_running = Time.now, true # Loop Requests @users.times { Looper.new(self).loop! } @runs += 1 end