aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2010-06-23 16:11:07 -0700
committerJeremy Kemper <jeremy@bitsweat.net>2010-06-23 16:11:13 -0700
commit7b730a2f1b9be71695c1a01efc1fd05e98757736 (patch)
tree25e9344adad5fc082480191ec689ea2e4db0b6e6 /tools
parent69abbe893413c99808c8cebd2f1d468c7921c573 (diff)
downloadrails-7b730a2f1b9be71695c1a01efc1fd05e98757736.tar.gz
rails-7b730a2f1b9be71695c1a01efc1fd05e98757736.tar.bz2
rails-7b730a2f1b9be71695c1a01efc1fd05e98757736.zip
Show GC time and # of runs too
Diffstat (limited to 'tools')
-rwxr-xr-xtools/profile4
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/profile b/tools/profile
index f02f1b5057..c86cedcbf4 100755
--- a/tools/profile
+++ b/tools/profile
@@ -39,6 +39,7 @@ end
GC.start
before = GC.allocated_size
+before_gctime, before_gcruns = GC.time, GC.collections
before_rss = `ps -o rss= -p #{Process.pid}`.to_i
before_live_objects = ObjectSpace.live_objects
@@ -54,6 +55,7 @@ end
elapsed = Benchmark.realtime { require path }
results = RubyProf.stop if mode
+after_gctime, after_gcruns = GC.time, GC.collections
GC.start
after_live_objects = ObjectSpace.live_objects
after_rss = `ps -o rss= -p #{Process.pid}`.to_i
@@ -79,4 +81,4 @@ RequireProfiler.stats.each do |file, depth, sec, bytes, objects|
puts "#{' ' * (42 + depth)}#{file}"
end
end
-puts "%10.2f KB %10d obj %8.1f ms %d KB RSS" % [usage, after_live_objects - before_live_objects, elapsed * 1000, after_rss - before_rss]
+puts "%10.2f KB %10d obj %8.1f ms %d KB RSS %8.1f ms GC time %d GC runs" % [usage, after_live_objects - before_live_objects, elapsed * 1000, after_rss - before_rss, (after_gctime - before_gctime) / 1000.0, after_gcruns - before_gcruns]