2013-06-20 02:33:02 +04:00
|
|
|
|
|
|
|
require 'benchmark'
|
|
|
|
require 'pp'
|
|
|
|
|
2013-06-20 12:25:16 +04:00
|
|
|
script = File.join(File.dirname(__FILE__), ARGV.shift)
|
2013-06-20 10:18:09 +04:00
|
|
|
script += '.rb' unless FileTest.exist?(script)
|
|
|
|
raise "#{script} not found" unless FileTest.exist?(script)
|
|
|
|
|
|
|
|
puts "Script: #{script}"
|
2013-06-20 02:33:02 +04:00
|
|
|
|
|
|
|
GC::Profiler.enable
|
|
|
|
tms = Benchmark.measure{|x|
|
|
|
|
load script
|
|
|
|
}
|
2013-06-20 13:00:41 +04:00
|
|
|
GC::Profiler.disable
|
2013-06-20 02:33:02 +04:00
|
|
|
GC::Profiler.report
|
|
|
|
pp GC.stat
|
|
|
|
|
|
|
|
gc_time = GC::Profiler.total_time
|
|
|
|
|
|
|
|
puts
|
2013-06-20 10:18:09 +04:00
|
|
|
puts script
|
2013-06-20 02:33:02 +04:00
|
|
|
puts Benchmark::CAPTION
|
|
|
|
puts tms
|
|
|
|
puts "GC total time (sec): #{gc_time}"
|
|
|
|
puts
|
2013-06-20 03:15:56 +04:00
|
|
|
puts "Summary #{RUBY_DESCRIPTION}\t#{tms.real}\t#{gc_time}\t#{GC.count}"
|
|
|
|
puts " (real time in sec, GC time in sec, GC count)"
|