Module: HanselCore::Httperf
- Included in:
- Hansel
- Defined in:
- lib/hansel/httperf/httperf.rb
Instance Method Summary collapse
- #build_httperf_cmd ⇒ Object
-
#httperf(warm_up = false) ⇒ Object
Runs httperf with a given request rate.
Instance Method Details
#build_httperf_cmd ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/hansel/httperf/httperf.rb', line 3 def build_httperf_cmd = @current_job. httperf_cmd = [ "httperf --hog", "--server=#{@current_job.server}", "--port=#{@current_job.port}", "--uri=#{@current_job.uri}", "--num-conns=#{@current_job.num_conns}", "--rate=#{@current_rate}", && "--add-header='Cookie: #{}\\n'" ].compact.join ' ' end |
#httperf(warm_up = false) ⇒ Object
Runs httperf with a given request rate. Parses the output and returns a hash with the results.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/hansel/httperf/httperf.rb', line 20 def httperf warm_up = false httperf_cmd = build_httperf_cmd if warm_up # Do a warm up run to setup any resources status "\n#{httperf_cmd} (warm up run)" IO.popen("#{httperf_cmd} 2>&1") else IO.popen("#{httperf_cmd} 2>&1") do |pipe| status "\n#{httperf_cmd}" @results << (httperf_result = HttperfResult.new({ :rate => @current_rate, :server => @current_job.server, :port => @current_job.port, :uri => @current_job.uri, :num_conns => @current_job.num_conns, :description => @current_job.description })) HttperfResultParser.new(pipe).parse(httperf_result) end end end |