aboutsummaryrefslogtreecommitdiffstats
path: root/benchmark/gc/gcbench.rb
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-20 06:18:09 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-20 06:18:09 +0000
commit99b10ff471c50358ed0f6864f4cf87857c51a91d (patch)
treee8c951ec1afa18da031e3b140db30823163a61cb /benchmark/gc/gcbench.rb
parentab7e4592106e0796d5b243c0d0c8629a47351e05 (diff)
downloadruby-99b10ff471c50358ed0f6864f4cf87857c51a91d.tar.gz
* benchmark/gc: create a directory to store GC related benchmark.
* benchmark/gc/gcbench.rb: moved from tool/gcbench.rb. * benchmark/gc/hash(1|2).rb: ditto. * benchmark/gc/rdoc.rb: ditto. * benchmark/gc/null.rb: added. * common.mk: fix rule. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41473 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'benchmark/gc/gcbench.rb')
-rw-r--r--benchmark/gc/gcbench.rb27
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)"