Module: BWAPI::Performance
- Included in:
- Client
- Defined in:
- lib/bwapi/performance.rb
Overview
Performance module
Instance Method Summary collapse
- #average_response_time ⇒ Object
- #average_response_time_breakdown ⇒ Object
- #fastest_response ⇒ Object
- #response_paths ⇒ Object
- #slowest_response ⇒ Object
- #total_responses ⇒ Object
Instance Method Details
#average_response_time ⇒ Object
7 8 9 10 11 |
# File 'lib/bwapi/performance.rb', line 7 def average_response_time averages = [] performance.each_key { |key| averages << Allotment.results[key].average } averages.average end |
#average_response_time_breakdown ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/bwapi/performance.rb', line 13 def average_response_time_breakdown results = [] performance.each do |key, value| results << Hashie::Mash.new(path: key, average: Allotment.results[key].average, count: value.size) end results end |
#fastest_response ⇒ Object
21 22 23 |
# File 'lib/bwapi/performance.rb', line 21 def fastest_response average_response_time_breakdown.sort_by { |result| result[:average] }.first end |
#response_paths ⇒ Object
25 26 27 |
# File 'lib/bwapi/performance.rb', line 25 def response_paths performance.keys end |
#slowest_response ⇒ Object
29 30 31 |
# File 'lib/bwapi/performance.rb', line 29 def slowest_response average_response_time_breakdown.sort_by { |result| result[:average] }.reverse.first end |
#total_responses ⇒ Object
33 34 35 36 37 |
# File 'lib/bwapi/performance.rb', line 33 def total_responses responses = 0 performance.each_value { |value| responses += value.size } responses end |