1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
ko1 2012-10-24 08:46:01 +00:00
parent a4ba41a29d
commit 9b68747be0
2 changed files with 12 additions and 0 deletions

View file

@ -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

View file

@ -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
}