[前][次][番号順一覧][スレッド一覧]

ruby-changes:25262

From: ko1 <ko1@a...>
Date: Wed, 24 Oct 2012 17:46:16 +0900 (JST)
Subject: [ruby-changes:25262] ko1:r37314 (trunk): * benchmark/driver.rb: add `-x' or `--exclude' option

ko1	2012-10-24 17:46:01 +0900 (Wed, 24 Oct 2012)

  New Revision: 37314

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=37314

  Log:
    * benchmark/driver.rb: add `-x' or `--exclude' option
      to specify exclude benchmark name pattern.
      You can specify "-x foo" if you want to exclude the benchmarks
      if the name of benchmark contains `foo'.

  Modified files:
    trunk/ChangeLog
    trunk/benchmark/driver.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 37313)
+++ ChangeLog	(revision 37314)
@@ -1,3 +1,10 @@
+Wed Oct 24 17:41:24 2012  Koichi Sasada  <ko1@a...>
+
+	* benchmark/driver.rb: add `-x' or `--exclude' option
+	  to specify exclude benchmark name pattern.
+	  You can specify "-x foo" if you want to exclude the benchmarks
+	  if the name of benchmark contains `foo'.
+
 Wed Oct 24 11:57:24 2012  Narihiro Nakamura  <authornari@g...>
 
 	* gc.c (gc_prepare_free_objects): rename to match the behavior of
Index: benchmark/driver.rb
===================================================================
--- benchmark/driver.rb	(revision 37313)
+++ benchmark/driver.rb	(revision 37314)
@@ -73,6 +73,7 @@
     @repeat = opt[:repeat] || 1
     @repeat = 1 if @repeat < 1
     @pattern = opt[:pattern] || nil
+    @exclude = opt[:exclude] || nil
     @verbose = opt[:quiet] ? false : (opt[:verbose] || false)
     @output = opt[:output] ? open(opt[:output], 'w') : nil
     @loop_wl1 = @loop_wl2 = nil
@@ -175,6 +176,7 @@
     flag = {}
     @files = Dir.glob(File.join(@dir, 'bm*.rb')).map{|file|
       next if @pattern && /#{@pattern}/ !~ File.basename(file)
+      next if @exclude && /#{@exclude}/ =~ File.basename(file)
       case file
       when /bm_(vm[12])_/, /bm_loop_(whileloop2?).rb/
         flag[$1] = true
@@ -270,6 +272,9 @@
     o.on('-p', '--pattern [PATTERN]', "Benchmark name pattern"){|p|
       opt[:pattern] = p
     }
+    o.on('-x', '--exclude [PATTERN]', "Benchmark exclude pattern"){|e|
+      opt[:exclude] = e
+    }
     o.on('-r', '--repeat-count [NUM]', "Repeat count"){|n|
       opt[:repeat] = n.to_i
     }

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]