Class: Kronk::Player::TSV
- Inherits:
-
Kronk::Player
- Object
- QueueRunner
- Kronk::Player
- Kronk::Player::TSV
- Defined in:
- lib/kronk/player/tsv.rb
Overview
Outputs player request and response metrics as a tab seperated values.
Instance Attribute Summary
Attributes inherited from Kronk::Player
#concurrency, #input, #mutex, #qps
Attributes inherited from QueueRunner
#count, #number, #queue, #reader_thread, #threads
Instance Method Summary collapse
Methods inherited from Kronk::Player
#compare, #from_io, #initialize, new_type, #request, #run, #trigger_result
Methods inherited from QueueRunner
#concurrently, #finish, #finished?, #initialize, #kill, #on, #periodically, #start_input!, #stop_input!, #trigger, #until_finished, #yield_queue_item
Constructor Details
This class inherits a constructor from Kronk::Player
Instance Method Details
#result(kronk) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/kronk/player/tsv.rb', line 26 def result kronk suite_time = Time.now - @start_time qps = (@count / suite_time).round(3) kronk.responses.each do |resp| @mutex.synchronize do @total_bytes += resp.total_bytes req_time = ((Time.now - resp.time).to_f * 1000).to_i $stdout.puts [ req_time, (resp.time * 1000).round, resp.bytes, (@total_bytes / suite_time).round, qps, resp.code, resp.uri.scheme, resp.uri.host, resp.uri.port, resp.uri.path ].join("\t") end end end |
#start ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/kronk/player/tsv.rb', line 8 def start @total_bytes = 0 $stdout.puts %w{ timestamp(ms) resp_time(ms) bytes bps qps code scheme host port path }.join("\t") end |