Sha256: 6ccc7e1bca4160b5952eaeb36db3661e367a08b7b23f8c3ecea25f302bb1c578

Contents?: true

Size: 1.2 KB

Versions: 2

Compression:

Stored size: 1.2 KB

Contents



module Stella::Test::Run

  class Summary < Stella::Storable
    
    attr_accessor :note
    attr_accessor :tool, :version
    attr_accessor :test, :transactions, :headers_transferred
    attr_accessor :elapsed_time, :data_transferred, :response_time
    attr_accessor :successful, :failed, :transaction_rate, :vusers, :raw
    
    def initialize(note="")
      @note = note
      @transactions = 0
      @headers_transferred = 0
      @elapsed_time = 0
      @data_transferred = 0
      @response_time = 0
      @successful = 0
      @failed = 0
      @transaction_rate = 0
      @vusers = 0
    end
    
    def availability
      return 0 if @successful == 0
      (@transactions / @successful).to_f * 100
    end
    
    # We calculate the throughput because Apache Bench does not provide this
    # value in the output. 
    def throughput
      return 0 if !@elapsed_time || @elapsed_time == 0
      (@data_transferred / @elapsed_time).to_f
    end
    
    def field_names
      [
        :availability, :transactions, :elapsed_time, :data_transferred,
        :headers_transferred, :response_time, :transaction_rate, :throughput,
        :vusers, :successful, :failed, :note
      ]
    end
    
  end
  
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
stella-0.3.2 lib/stella/test/run/summary.rb
stella-0.5.3 lib/stella/test/run/summary.rb