Class: DeepTest::Distributed::ThroughputRunner
- Inherits:
-
Object
- Object
- DeepTest::Distributed::ThroughputRunner
- Defined in:
- lib/deep_test/distributed/throughput_runner.rb
Instance Method Summary collapse
- #blackboard ⇒ Object
-
#initialize(options, test_count, blackboard = nil, &block) ⇒ ThroughputRunner
constructor
A new instance of ThroughputRunner.
- #process_work_units ⇒ Object
- #statistics ⇒ Object
Constructor Details
#initialize(options, test_count, blackboard = nil, &block) ⇒ ThroughputRunner
Returns a new instance of ThroughputRunner.
4 5 6 7 8 9 |
# File 'lib/deep_test/distributed/throughput_runner.rb', line 4 def initialize(, test_count, blackboard = nil, &block) @options = @test_count = test_count @blackboard = blackboard @progress_block = block end |
Instance Method Details
#blackboard ⇒ Object
11 12 13 |
# File 'lib/deep_test/distributed/throughput_runner.rb', line 11 def blackboard @blackboard ||= @options.server end |
#process_work_units ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# 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 ⇒ Object
15 16 17 |
# File 'lib/deep_test/distributed/throughput_runner.rb', line 15 def statistics ThroughputStatistics.new(@test_count, @start_time, @end_time) end |