Kouhei Sutou
kou****@clear*****
Mon Oct 7 15:05:01 JST 2013
> + parser.on("--threads=COUNT",
> + "count of threads") do |threads|
> + options[:threads] = threads.to_i
> + end
droongaでは設定ファイルとかでn_XXX(n_workersとか)を使って
いるのでXXX_COUNTよりもn_XXXの方がいいです!
--n-threads=N
The number of threads
みたいな。
In <14abe56b9e7cce01cb6029576efda00d39871e69 �� jenkins.clear-code.com>
"[Groonga-commit] droonga/http-benchmark �� 14abe56 [master] Add skelton" on Mon, 07 Oct 2013 14:59:13 +0900,
YUKI Hiroshi <null+groonga �� clear-code.com> wrote:
> YUKI Hiroshi 2013-10-07 14:59:13 +0900 (Mon, 07 Oct 2013)
>
> New Revision: 14abe56b9e7cce01cb6029576efda00d39871e69
> https://github.com/droonga/http-benchmark/commit/14abe56b9e7cce01cb6029576efda00d39871e69
>
> Message:
> Add skelton
>
> Added files:
> bin/http-benchmark
> lib/droonga/http-benchmark.rb
>
> Added: bin/http-benchmark (+29 -0) 100755
> ===================================================================
> --- /dev/null
> +++ bin/http-benchmark 2013-10-07 14:59:13 +0900 (cbef2c6)
> @@ -0,0 +1,29 @@
> +#!/usr/bin/env ruby
> +# -*- coding: utf-8 -*-
> +
> +require "droonga/http-benchmark"
> +require "optparse"
> +
> +options = {}
> +option_parser = OptionParser.new do |parser|
> + parser.on("--duration=SECONDS",
> + "duration of the benmark") do |duration|
> + options[:duration] = duration.to_f
> + end
> + parser.on("--threads=COUNT",
> + "count of threads") do |threads|
> + options[:threads] = threads.to_i
> + end
> +end
> +args = option_parser.parse!(ARGV)
> +
> +if options[:duration].nil?
> + raise "You must specify the test duration by --duration option."
> +end
> +if options[:threads].nil?
> + raise "You must specify the count of request threads by --threads option."
> +end
> +
> +benchmark = Droonga::HttpBenchmark.new(:duration => options[:duration],
> + :threads_count => options[:threads])
> +benchmark.run
>
> Added: lib/droonga/http-benchmark.rb (+17 -0) 100644
> ===================================================================
> --- /dev/null
> +++ lib/droonga/http-benchmark.rb 2013-10-07 14:59:13 +0900 (e46358a)
> @@ -0,0 +1,17 @@
> +# -*- coding: utf-8 -*-
> +
> +class HttpBenchmark
> + attr_reader :duration, :threads_count
> +
> + MIN_DURATION = 1.0
> + MAX_THREADS_COUNT = 16
> +
> + def initialize(params)
> + @duration = [params[:duration], MIN_DURATION].max
> + @threads_count = [params[:threads_count], MAX_THREADS_COUNT].min
> + end
> +
> + def run
> + raise "not implemented"
> + end
> +end