Class: Ralphttp::Wreckit
Overview
Public; Get benchmarking information for a HTTP server
Instance Attribute Summary collapse
-
#domain ⇒ Object
Returns the value of attribute domain.
-
#hammer ⇒ Object
Returns the value of attribute hammer.
-
#ua ⇒ Object
Returns the value of attribute ua.
Attributes inherited from Fixit
#bucket, #csv, #csvexport, #detailed, #error, #req, #status, #total_time
Instance Method Summary collapse
-
#blast ⇒ Object
Public: Worker method, builds threads for querying the server.
-
#initialize(options) ⇒ Wreckit
constructor
Public: Start the class and assign the domain anem to start.
Methods inherited from Fixit
#analyze, #display_results, #print_header
Constructor Details
#initialize(options) ⇒ Wreckit
24 25 26 27 28 29 30 31 |
# File 'lib/ralphttp/wreckit.rb', line 24 def initialize() super() @domain = [:url] @ua = [:useragent] @hammer = { :concurrent => [:concurrent], :total => [:requests] } @bucket = {} end |
Instance Attribute Details
#domain ⇒ Object
Returns the value of attribute domain.
8 9 10 |
# File 'lib/ralphttp/wreckit.rb', line 8 def domain @domain end |
#hammer ⇒ Object
Returns the value of attribute hammer.
9 10 11 |
# File 'lib/ralphttp/wreckit.rb', line 9 def hammer @hammer end |
#ua ⇒ Object
Returns the value of attribute ua.
10 11 12 |
# File 'lib/ralphttp/wreckit.rb', line 10 def ua @ua end |
Instance Method Details
#blast ⇒ Object
Public: Worker method, builds threads for querying the server
Returns nil
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/ralphttp/wreckit.rb', line 36 def blast arr = [] start = Time.now num_loops = calculate_loops (1..num_loops.to_i).each do |f| Thread.abort_on_exception = false (1..@hammer[:concurrent].to_i).each do |s| arr[s] = Thread.new do start_http end end arr.shift arr.each do |t| t.join end end @total_time = sprintf('%.2f', (Time.now - start)) @bucket.keys.sort end |