lib/stella/adapter/httperf.rb in stella-0.5.1 vs lib/stella/adapter/httperf.rb in stella-0.5.3

- old
+ new

@@ -53,13 +53,13 @@ # It's important that we take the value from the getter method # because it applies the load factor. value = self.send(canon) if (value.is_a? Array) - value.each { |el| command << "--#{canon.tr('_', '-')} '#{el}' " } + value.each { |el| command << "--#{canon.tr('_', '-')} #{EscapeUtil.shell_single_word(el.to_s)} " } else - command << "--#{canon.tr('_', '-')} '#{value}' " + command << "--#{canon.tr('_', '-')} #{EscapeUtil.shell_single_word(value.to_s)} " end end command << (@arguments.map { |uri| "'#{uri}'" }).join(' ') unless @arguments.empty? @@ -100,11 +100,11 @@ opts.on('--no-host-hdr') do |v| @no_host_hdr = true end opts.on('--retry-on-failure') do |v| @retry_on_failure = true end opts.on('--add-header=S', String) do |v| @add_header ||= []; @add_header << v; end opts.on('--burst-length=N', Integer) do |v| @burst_length = v end - opts.on('--client=N', Integer) do |v| @client = v end + opts.on('--client=S', String) do |v| @client = v end opts.on('-d N', '--debug=N', Integer) do |v| @debug ||= 0; @debug = v end opts.on('--failure-status=N', Integer) do |v| @failure_status = v end opts.on('--http-version=S', String) do |v| @http_version = v end @@ -159,10 +159,26 @@ end def ready? @name && !instance_variables.empty? end + def add_header(name=false, value=false) + # This is a hack since we have an instance variable called add_header. + # I figure this is the best of two evils because I'd rather keep the + # instance variable naming consistent. + return @add_header if !name && !value + @add_header ||= [] + @add_header << "#{name}: #{value}" + end + + def user_agent=(list=[]) + return unless list && !list.empty? + list = list.to_ary + list.each do |agent| + add_header("User-Agent", agent) + end + end def vusers @rate end def vusers=(v) 0 @@ -174,11 +190,26 @@ 0 end def vuser_requests 0 end + def wsess + @wsess.join(',') + end + def wset + @wset.join(',') + end + + + def wsesslog + @wsesslog.join(',') + end + def wlog + @wlog.join(',') + end + #def concurrent # (@concurrent * @load_factor).to_i #end #def concurrent_f # (@concurrent * @load_factor).to_f @@ -233,10 +264,10 @@ def stats return unless stats_file raw = stats_file.readlines.join - stats = Stella::Test::RunSummary.new + stats = Stella::Test::Run::Summary.new raw.scan(/Request rate: (\d+?\.\d+?) req.s .(\d+?\.\d+?) ms.req./) do |rate,time| stats.transaction_rate = rate.to_f stats.response_time = (time.to_f) / 1000 end \ No newline at end of file