Class: Mutalisk::RunnerThread
- Inherits:
-
Object
- Object
- Mutalisk::RunnerThread
- Defined in:
- lib/mutalisk/runner_thread.rb
Instance Attribute Summary collapse
-
#results ⇒ Object
readonly
Returns the value of attribute results.
-
#thread_id ⇒ Object
readonly
Returns the value of attribute thread_id.
Instance Method Summary collapse
-
#initialize(options, pipe, id) ⇒ RunnerThread
constructor
A new instance of RunnerThread.
- #join ⇒ Object
- #start ⇒ Object
Constructor Details
#initialize(options, pipe, id) ⇒ RunnerThread
Returns a new instance of RunnerThread.
6 7 8 9 10 11 12 13 14 |
# File 'lib/mutalisk/runner_thread.rb', line 6 def initialize(, pipe, id) = @connections = [] @responses = [] @pipe = pipe @interrupted = false @thread_id = id end |
Instance Attribute Details
#results ⇒ Object (readonly)
Returns the value of attribute results.
3 4 5 |
# File 'lib/mutalisk/runner_thread.rb', line 3 def results @results end |
#thread_id ⇒ Object (readonly)
Returns the value of attribute thread_id.
4 5 6 |
# File 'lib/mutalisk/runner_thread.rb', line 4 def thread_id @thread_id end |
Instance Method Details
#join ⇒ Object
38 39 40 41 42 |
# File 'lib/mutalisk/runner_thread.rb', line 38 def join @thread.join Stats.collect(@responses.map(&:to_h)) end |
#start ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/mutalisk/runner_thread.rb', line 16 def start @t0 = Time.now @thread = Thread.new { # slow start until @connections.size == [:connections] spawn_connection send_requests check_response end # full speed loop do send_requests check_response break if times_up? or @interrupted end generate_report } end |