YUKI Hiroshi
null+****@clear*****
Mon Oct 7 15:50:42 JST 2013
YUKI Hiroshi 2013-10-07 15:50:42 +0900 (Mon, 07 Oct 2013) New Revision: 435d1da4a37417ec6c4360d90c13ec2bd18d33c7 https://github.com/droonga/http-benchmark/commit/435d1da4a37417ec6c4360d90c13ec2bd18d33c7 Message: Add "wait" option for each request Modified files: bin/http-benchmark lib/droonga/http-benchmark.rb Modified: bin/http-benchmark (+5 -0) =================================================================== --- bin/http-benchmark 2013-10-07 15:48:43 +0900 (8cc3eeb) +++ bin/http-benchmark 2013-10-07 15:50:42 +0900 (8780d61) @@ -10,6 +10,10 @@ option_parser = OptionParser.new do |parser| "duration of the benmark") do |duration| options[:duration] = duration end + parser.on("--wait=SECONDS", Float, + "wait for each request") do |wait| + options[:wait] = wait + end parser.on("--n-threads=N", Integer, "number of threads") do |n_threads| options[:n_threads] = n_threads @@ -25,5 +29,6 @@ if options[:threads].nil? end benchmark = Droonga::HttpBenchmark.new(:duration => options[:duration], + :wait => options[:wait], :n_threads => options[:n_threads]) benchmark.run Modified: lib/droonga/http-benchmark.rb (+2 -0) =================================================================== --- lib/droonga/http-benchmark.rb 2013-10-07 15:48:43 +0900 (b826942) +++ lib/droonga/http-benchmark.rb 2013-10-07 15:50:42 +0900 (084e878) @@ -4,12 +4,14 @@ class HttpBenchmark attr_reader :duration, :threads_count MIN_DURATION = 1.0 + MIN_WAIT = 0 MAX_N_THREADS = 16 TOTAL_N_REQUESTS = 1000, def initialize(params) @duration = [params[:duration], MIN_DURATION].max + @wait = [params[:wait], MIN_WAIT].max @n_threads = [params[:n_threads], MAX_N_THREADS].min @n_requests = params[:n_requests] || TOTAL_N_REQUESTS -------------- next part -------------- HTML����������������������������... Download