blob: ca9f3cd950c1fcd88d605b39ac4a07f56f1e5f2c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
require 'benchmark'
require 'pp'
script = ARGV.shift || raise
GC::Profiler.enable
tms = Benchmark.measure{|x|
load script
}
GC::Profiler.report
pp GC.stat
gc_time = GC::Profiler.total_time
puts
puts Benchmark::CAPTION
puts tms
puts "GC total time (sec): #{gc_time}"
puts
puts "Summary #{RUBY_DESCRIPTION}\t#{tms.real}\t#{gc_time}\t#{GC.count}"
puts " (real time in sec, GC time in sec, GC count)"
|