# File lib/bigbench/benchmark/looper.rb, line 9 def initialize(benchmark) @benchmark, @loops = benchmark, 0 @fragments = Fiber.new { @benchmark.fragments.cycle{ |fragment| Fiber.yield(fragment) } } end
# File lib/bigbench/benchmark/looper.rb, line 14 def loop! return unless @benchmark.is_running? @loops += 1 # Start next fragment fragment = next_fragment start = Time.now http = fragment.run! # Success http.callback do |http| fragment.track!(start, Time.now, http) loop! end # Error http.errback do |http| fragment.track!(start, Time.now, http) loop! end end
# File lib/bigbench/benchmark/looper.rb, line 37 def next_fragment @fragments.resume end