summaryrefslogtreecommitdiff
path: root/test/profile_test_all.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-10-29 23:50:57 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-10-29 23:50:57 +0000
commit4e11a8997decc2dfbea5daad5108d1301f287e53 (patch)
tree177473ac0d9a048929e2cad09e083cb404f28317 /test/profile_test_all.rb
parentaeab9011fef77ea09786818a01a684c5f8adbd4a (diff)
property.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29634 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/profile_test_all.rb')
-rw-r--r--test/profile_test_all.rb104
1 files changed, 52 insertions, 52 deletions
diff --git a/test/profile_test_all.rb b/test/profile_test_all.rb
index 52eaf364aa..54e916b73b 100644
--- a/test/profile_test_all.rb
+++ b/test/profile_test_all.rb
@@ -1,52 +1,52 @@
-require 'objspace'
-
-#
-# purpose:
-# Profile memory usage of each tests.
-#
-# usage:
-# RUBY_TEST_ALL_PROFILE=true make test-all
-#
-# output:
-# ./test_all_profile
-#
-# collected information:
-# - ObjectSpace.memsize_of_all
-# - GC.stat
-# - /proc/self/statm (if it exists)
-#
-
-class MiniTest::Unit::TestCase
- alias orig_run run
-
- $test_all_profile_out = open('test_all_profile', 'w')
- $test_all_profile_gc_stat_hash = {}
-
- if FileTest.exist?('/proc/self/statm')
- # for Linux (only?)
- $test_all_profile_out.puts "name\tmemsize_of_all\t" +
- (GC.stat.keys +
- %w(size resident share text lib data dt)).join("\t")
-
- def memprofile_test_all_result_result
- "#{self.class}\##{self.__name__}\t" \
- "#{ObjectSpace.memsize_of_all}\t" \
- "#{GC.stat($test_all_profile_gc_stat_hash).values.join("\t")}\t" \
- "#{File.read('/proc/self/statm').split(/\s+/).join("\t")}"
- end
- else
- $test_all_profile_out.puts "name\tmemsize_of_alls\t" + GC.stat.keys.join("\t")
- def memprofile_test_all_result_result
- "#{self.class}\##{self.__name__}\t" \
- "#{ObjectSpace.memsize_of_all}\t" \
- "#{GC.stat($test_all_profile_gc_stat_hash).values.join("\t")}"
- end
- end
-
- def run runner
- result = orig_run(runner)
- $test_all_profile_out.puts memprofile_test_all_result_result
- $test_all_profile_out.flush
- result
- end
-end
+require 'objspace'
+
+#
+# purpose:
+# Profile memory usage of each tests.
+#
+# usage:
+# RUBY_TEST_ALL_PROFILE=true make test-all
+#
+# output:
+# ./test_all_profile
+#
+# collected information:
+# - ObjectSpace.memsize_of_all
+# - GC.stat
+# - /proc/self/statm (if it exists)
+#
+
+class MiniTest::Unit::TestCase
+ alias orig_run run
+
+ $test_all_profile_out = open('test_all_profile', 'w')
+ $test_all_profile_gc_stat_hash = {}
+
+ if FileTest.exist?('/proc/self/statm')
+ # for Linux (only?)
+ $test_all_profile_out.puts "name\tmemsize_of_all\t" +
+ (GC.stat.keys +
+ %w(size resident share text lib data dt)).join("\t")
+
+ def memprofile_test_all_result_result
+ "#{self.class}\##{self.__name__}\t" \
+ "#{ObjectSpace.memsize_of_all}\t" \
+ "#{GC.stat($test_all_profile_gc_stat_hash).values.join("\t")}\t" \
+ "#{File.read('/proc/self/statm').split(/\s+/).join("\t")}"
+ end
+ else
+ $test_all_profile_out.puts "name\tmemsize_of_alls\t" + GC.stat.keys.join("\t")
+ def memprofile_test_all_result_result
+ "#{self.class}\##{self.__name__}\t" \
+ "#{ObjectSpace.memsize_of_all}\t" \
+ "#{GC.stat($test_all_profile_gc_stat_hash).values.join("\t")}"
+ end
+ end
+
+ def run runner
+ result = orig_run(runner)
+ $test_all_profile_out.puts memprofile_test_all_result_result
+ $test_all_profile_out.flush
+ result
+ end
+end