Sha256: 5c6231924edcc2cc07f8896fc470151b708df54c3b1acd683a95b12fcdcebcb1

Contents?: true

Size: 609 Bytes

Versions: 4

Compression:

Stored size: 609 Bytes

Contents

# Simple script that hits a host port and URI with a bunch of connections
# and measures the timings.

require 'rfuzz/client'
require 'rfuzz/stats'
include RFuzz



if ARGV.length != 4
  STDERR.puts "usage:  ruby perftest.rb host port uri count"
  exit 1
end

host, port, uri, count = ARGV[0], ARGV[1], ARGV[2], ARGV[3].to_i

codes = {}
cl = HttpClient.new(host, port, :notifier => StatsTracker.new)
count.times do
  begin
    resp = cl.get(uri)
    code = resp.http_status.to_i
    codes[code] ||= 0
    codes[code] += 1
  rescue Object
  end
end

puts cl.notifier.to_s
puts "Status Codes: #{codes.inspect}"

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rfuzz-0.7 examples/perftest.rb
rfuzz-0.9 examples/perftest.rb
rfuzz-0.6 examples/perftest.rb
rfuzz-0.8 examples/perftest.rb