class DeepTest::Distributed::ThroughputRunner

Public Class Methods

new(options, test_count, blackboard = nil, &block) click to toggle source
# File lib/deep_test/distributed/throughput_runner.rb, line 4
def initialize(options, test_count, blackboard = nil, &block)
  @options = options
  @test_count = test_count
  @blackboard = blackboard
  @progress_block = block
end

Public Instance Methods

blackboard() click to toggle source
# File lib/deep_test/distributed/throughput_runner.rb, line 11
def blackboard
  @blackboard ||= @options.server
end
process_work_units() click to toggle source
# File lib/deep_test/distributed/throughput_runner.rb, line 19
def process_work_units
  @start_time = Time.now

  @test_count.times do
    blackboard.write_work NullWorkUnit.new
  end
 
  results_read = 0
  until results_read == @test_count
    Thread.pass
    result = blackboard.take_result
    if result
      results_read += 1 
      @progress_block.call(result) if @progress_block
    end
  end

  @end_time = Time.now

  true
end
statistics() click to toggle source
# File lib/deep_test/distributed/throughput_runner.rb, line 15
def statistics
  ThroughputStatistics.new(@test_count, @start_time, @end_time)
end