[Groonga-commit] droonga/drnbench at a2cc6e1 [master] Ensure running teardown

Back to archive index

Kouhei Sutou null+****@clear*****
Tue Jan 21 15:59:48 JST 2014


Kouhei Sutou	2014-01-21 15:59:48 +0900 (Tue, 21 Jan 2014)

  New Revision: a2cc6e14245dc0a66d7c1d1a38dcb3aaf7a5e558
  https://github.com/droonga/drnbench/commit/a2cc6e14245dc0a66d7c1d1a38dcb3aaf7a5e558

  Message:
    Ensure running teardown

  Modified files:
    lib/drnbench/publish-subscribe/gradual-runner.rb

  Modified: lib/drnbench/publish-subscribe/gradual-runner.rb (+22 -14)
===================================================================
--- lib/drnbench/publish-subscribe/gradual-runner.rb    2014-01-21 15:55:21 +0900 (bccbe5f)
+++ lib/drnbench/publish-subscribe/gradual-runner.rb    2014-01-21 15:59:48 +0900 (0b89b1a)
@@ -16,27 +16,35 @@ module Drnbench
       def run
         results = []
         @runner.setup
-        @config.n_steps.times do
-          @runner.increase_subscribers
-          label = "#{@runner.n_subscribers} subscribers"
-          result = Benchmark.bm do |benchmark|
-            benchmark.report(label) do
-              @runner.run
-            end
+        begin
+          @config.n_steps.times do
+            run_once(results)
           end
-          result = result.join("").strip.gsub(/[()]/, "").split(/\s+/)
-          qps =****@confi*****_publishings.to_f / result.last.to_f
-          if****@confi*****_progressively
-            puts "   (#{qps} queries per second)"
-          end
-          results << [label, qps]
+        ensure
+          @runner.teardown
         end
-        @runner.teardown
         @total_results = [
           ["case", "qps"],
         ]
         @total_results += results
       end
+
+      private
+      def run_once(results)
+        @runner.increase_subscribers
+        label = "#{@runner.n_subscribers} subscribers"
+        result = Benchmark.bm do |benchmark|
+          benchmark.report(label) do
+            @runner.run
+          end
+        end
+        result = result.join("").strip.gsub(/[()]/, "").split(/\s+/)
+        qps =****@confi*****_publishings.to_f / result.last.to_f
+        if****@confi*****_progressively
+          puts "   (#{qps} queries per second)"
+        end
+        results << [label, qps]
+      end
     end
   end
 end
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index