diff options
Diffstat (limited to 'benchmark/gc/gcbench.rb')
-rw-r--r-- | benchmark/gc/gcbench.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/benchmark/gc/gcbench.rb b/benchmark/gc/gcbench.rb new file mode 100644 index 0000000000..5fee2a2bce --- /dev/null +++ b/benchmark/gc/gcbench.rb @@ -0,0 +1,27 @@ + +require 'benchmark' +require 'pp' + +script = File.join(__dir__, ARGV.shift) +script += '.rb' unless FileTest.exist?(script) +raise "#{script} not found" unless FileTest.exist?(script) + +puts "Script: #{script}" + +GC::Profiler.enable +tms = Benchmark.measure{|x| + load script +} +GC::Profiler.report +pp GC.stat + +gc_time = GC::Profiler.total_time + +puts +puts script +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)" |