ruby-changes:31464
From: ko1 <ko1@a...>
Date: Wed, 6 Nov 2013 07:13:27 +0900 (JST)
Subject: [ruby-changes:31464] ko1:r43543 (trunk): * benchmark/gc/gcbench.rb: add some options to make quiet.
ko1 2013-11-06 07:13:08 +0900 (Wed, 06 Nov 2013) New Revision: 43543 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=43543 Log: * benchmark/gc/gcbench.rb: add some options to make quiet. Modified files: trunk/ChangeLog trunk/benchmark/gc/gcbench.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 43542) +++ ChangeLog (revision 43543) @@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Wed Nov 6 07:12:17 2013 Koichi Sasada <ko1@a...> + + * benchmark/gc/gcbench.rb: add some options to make quiet. + Wed Nov 6 04:14:25 2013 Aaron Patterson <aaron@t...> * ext/psych/lib/psych/visitors/to_ruby.rb: process merge keys before Index: benchmark/gc/gcbench.rb =================================================================== --- benchmark/gc/gcbench.rb (revision 43542) +++ benchmark/gc/gcbench.rb (revision 43543) @@ -1,6 +1,14 @@ https://github.com/ruby/ruby/blob/trunk/benchmark/gc/gcbench.rb#L1 - require 'benchmark' require 'pp' +require 'optparse' + +$list = true +$gcprof = true + +opt = OptionParser.new +opt.on('-q'){$list = false} +opt.on('-d'){$gcprof = fales} +opt.parse!(ARGV) script = File.join(File.dirname(__FILE__), ARGV.shift) script += '.rb' unless FileTest.exist?(script) @@ -8,15 +16,23 @@ raise "#{script} not found" unless FileT https://github.com/ruby/ruby/blob/trunk/benchmark/gc/gcbench.rb#L16 puts "Script: #{script}" -GC::Profiler.enable +if $gcprof + GC::Profiler.enable +end + tms = Benchmark.measure{|x| load script } -gc_time = GC::Profiler.total_time -GC::Profiler.report if RUBY_VERSION >= '2.0.0' # before 1.9.3, report() may run infinite loop -GC::Profiler.disable -pp GC.stat +gc_time = 0 + +if $gcprof + gc_time = GC::Profiler.total_time + GC::Profiler.report if $list and RUBY_VERSION >= '2.0.0' # before 1.9.3, report() may run infinite loop + GC::Profiler.disable +end + +pp GC.stat desc = "#{RUBY_VERSION}#{RUBY_PATCHLEVEL >= 0 ? "p#{RUBY_PATCHLEVEL}" : "dev"}" name = File.basename(script, '.rb') -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/