summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-10-24 08:46:01 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-10-24 08:46:01 +0000
commit9b68747be0f70908d0147b4d753e322bab5a8b5c (patch)
tree1ab57e8916bcccf6e7194ce09223c91ec2528817
parenta4ba41a29d9d0281f7e62ef94ffbd778a34c91db (diff)
* 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'. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37314 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog7
-rw-r--r--benchmark/driver.rb5
2 files changed, 12 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index ad0ea0c..786ab97 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Wed Oct 24 17:41:24 2012 Koichi Sasada <ko1@atdot.net>
+
+ * 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@gmail.com>
* gc.c (gc_prepare_free_objects): rename to match the behavior of
diff --git a/benchmark/driver.rb b/benchmark/driver.rb
index 66bbe6b..c1e4a6c 100644
--- a/benchmark/driver.rb
+++ b/benchmark/driver.rb
@@ -73,6 +73,7 @@ class BenchmarkDriver
@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 @@ class BenchmarkDriver
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 @@ if __FILE__ == $0
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
}