class Siege::Results

Constants

AVAILABILITY
CONCURRENCY
DATA_TRANSFERRED
ELAPSED_TIME
FAILED_REQUESTS
LONGEST_REQUEST
RESPONSE_TIME
SHORTEST_REQUEST
THROUGHPUT
TRANSACTIONS
TRANSACTION_RATE

Attributes

availability[R]
concurrency[R]
data_transferred[R]
elapsed_time[R]
failed[R]
failed_requests[R]
longest[R]
longest_request[R]
response[R]
response_time[R]
shortest[R]
shortest_request[R]
throughput[R]
transaction_rate[R]
transactions[R]

Public Class Methods

for(results) click to toggle source
# File lib/siege/results.rb, line 5
def for(results)
  new results
end
new(results) click to toggle source
# File lib/siege/results.rb, line 31
def initialize(results)
  @results              = results
  @transactions         = Integer parse(:TRANSACTIONS)
  @availability         = Float   parse(:AVAILABILITY)
  @elapsed_time         = Float   parse(:ELAPSED_TIME)
  @data_transferred     = Float   parse(:DATA_TRANSFERRED)
  @response_time        = Float   parse(:RESPONSE_TIME)
  @transaction_rate     = Float   parse(:TRANSACTION_RATE)
  @throughput           = Float   parse(:THROUGHPUT)
  @concurrency          = Float   parse(:CONCURRENCY)
  @failed_requests      = Integer parse(:FAILED_REQUESTS)
  @longest_request      = Float   parse(:LONGEST_REQUEST)
  @shortest_request     = Float   parse(:SHORTEST_REQUEST)
rescue ArgumentError => e
  (e.message.include?('invalid value')) ? dump_results : raise(e)
end

Public Instance Methods

[](key) click to toggle source
# File lib/siege/results.rb, line 48
def[](key)
  to_h.fetch(key)
end
dump_results() click to toggle source
# File lib/siege/results.rb, line 77
def dump_results
  abort "A Siege error occurred:\n#{to_s}"
end
parse(const) click to toggle source
# File lib/siege/results.rb, line 72
def parse(const)
  dump_results unless match = self.class.const_get(const).match(to_s)
  match[1]
end
to_h() click to toggle source
# File lib/siege/results.rb, line 56
def to_h
  {
    transactions:         @transactions,
    availability:         @availability,
    elapsed_time:         @elapsed_time,
    data_transferred:     @data_transferred,
    response_time:        @response_time,
    transaction_rate:     @transaction_rate,
    throughput:           @throughput,
    concurrency:          @concurrency,
    failed_requests:      @failed_requests,
    longest_request:      @longest_request,
    shortest_request:     @shortest_request
  }
end
to_s() click to toggle source
# File lib/siege/results.rb, line 52
def to_s
  @to_s ||= @results
end