Module: Stella::Engine::Load
Defined Under Namespace
Classes: ThreadPackage
Instance Method Summary collapse
Methods included from Base
Instance Method Details
#run(plan, opts = {}) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/stella/engine/load.rb', line 7 def run(plan, opts={}) opts = { :hosts => [], :clients => 1, :time => nil, :benchmark => false, :repetitions => 1 }.merge! opts opts[:clients] = plan.usecases.size if opts[:clients] < plan.usecases.size opts[:clients] = 1000 if opts[:clients] > 1000 Stella.ld "OPTIONS: #{opts.inspect}" Stella.li3 "Hosts: " << opts[:hosts].join(', ') Stella.li2 plan.pretty packages = build_thread_package plan, opts Stella.li $/, "Prepared #{packages.size} virtual clients..." Stella.lflush Stella.li $/, "Starting test...", $/ Stella.lflush sleep 0.3 Thread.ify packages, :threads => opts[:clients] do |package| # TEMPFIX. The fill in build_thread_package is creating nil elements next if package.nil? (1..opts[:repetitions]).to_a.each do |rep| # We store client specific data in the usecase # so we clone it here so each thread is unique. Stella.rescue { package.client.execute package.usecase } end #package.client.benelux_timeline.each do |i| # Stella.li "#{package.client.client_id}: #{i.to_f}: #{i.name}" #end #t = Benelux.thread_timeline.sort #dur = t.last.to_f - t.first.to_f #Stella.li [:thread, t.first.name, t.last.name, dur].inspect #Stella.lflush end #t = Benelux.timeline.sort #dur = t.last.to_f - t.first.to_f #Stella.li [:global, t.first.name, t.last.name, dur].inspect #puts Thread.list #p Benelux.timeline prev = nil #Stella.li Benelux.timeline.sort.collect { |obj| # str = "#{obj.to_f}: #{obj.name} (#{obj.same_timeline?(prev)})" # prev = obj # str #} !plan.errors? end |