[Groonga-commit] droonga/fluent-plugin-droonga at f876e6e [master] Benchmark: output percentage of notified messages

アーカイブの一覧に戻る

YUKI Hiroshi null+****@clear*****
Mon Oct 28 19:51:24 JST 2013


YUKI Hiroshi	2013-10-28 19:51:24 +0900 (Mon, 28 Oct 2013)

  New Revision: f876e6e193fb8039482cebc27f8a841d04da0889
  https://github.com/droonga/fluent-plugin-droonga/commit/f876e6e193fb8039482cebc27f8a841d04da0889

  Message:
    Benchmark: output percentage of notified messages

  Modified files:
    benchmark/watch/benchmark-notify.rb

  Modified: benchmark/watch/benchmark-notify.rb (+13 -4)
===================================================================
--- benchmark/watch/benchmark-notify.rb    2013-10-28 19:31:13 +0900 (f1ff9f3)
+++ benchmark/watch/benchmark-notify.rb    2013-10-28 19:51:24 +0900 (548c578)
@@ -55,15 +55,21 @@ class NotifyBenchmark
   end
 
   def run
+    @n_times.times do |index|
+      do_feed("#{WATCHING_KEYWORD} #{index}")
+    end
+    notifications = []
     @n_times.times do
-      do_feed(WATCHING_KEYWORD)
+      notification =****@recei*****(:timeout => @timeout)
+      notifications << notification unless notification.nil?
     end
-    p****@recei*****(:timeout => @timeout)
+    notifications
   end
 
   def add_subscribers(n_subscribers)
-    n_subscribers.times do
+    n_subscribers.times do |index|
       message = DroongaBenchmark::MessageCreator.envelope_to_subscribe(WATCHING_KEYWORD)
+      message["body"]["subscriber"] += " #{@n_subscribers + index}"
       message["body"]["route"] = @route
       @client.connection.send_receive(message)
     end
@@ -114,11 +120,14 @@ results = []
 options[:n_steps].times do |try_count|
   notify_benchmark.add_subscribers(notify_benchmark.n_subscribers) if try_count > 0
   label = "#{notify_benchmark.n_subscribers} subscribers"
+  percentage = nil
   result = Benchmark.bmbm do |benchmark|
     benchmark.report(label) do
-      notify_benchmark.run
+      sent_notifications = notify_benchmark.run
+      percentage = sent_notifications.size.to_f / options[:n_times] * 100
     end
   end
+  puts "=> #{percentage} % feeds are notified"
   result = result.join("").strip.gsub(/[()]/, "").split(/\s+/)
   results << [label] + result
 end
-------------- next part --------------
HTML����������������������������...
ダウンロード 



More information about the Groonga-commit mailing list
アーカイブの一覧に戻る