mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* benchmark/gc/gcbench.rb: add some options to make quiet.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43543 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
4b7c15faa7
commit
400a9a7bc2
2 changed files with 26 additions and 6 deletions
|
@ -1,3 +1,7 @@
|
|||
Wed Nov 6 07:12:17 2013 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* benchmark/gc/gcbench.rb: add some options to make quiet.
|
||||
|
||||
Wed Nov 6 04:14:25 2013 Aaron Patterson <aaron@tenderlovemaking.com>
|
||||
|
||||
* ext/psych/lib/psych/visitors/to_ruby.rb: process merge keys before
|
||||
|
|
|
@ -1,6 +1,14 @@
|
|||
|
||||
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 FileTest.exist?(script)
|
|||
|
||||
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')
|
||||
|
||||
|
|
Loading…
Reference in a new issue