summaryrefslogtreecommitdiff
path: root/tool/gcbench.rb
blob: e16cb9ddce41d1e706e694e49ac78aed9a49d590 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

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): #{RUBY_DESCRIPTION} (#{script})"
puts "Summary (real): #{tms.real} sec"
puts "Summary (gctm): #{gc_time} sec"
puts "Summary (gc#) : #{GC.count}"