Created
October 29, 2013 02:07
-
-
Save tmm1/7208083 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/gc.c b/gc.c | |
index 415cc70..a570ae3 100644 | |
--- a/gc.c | |
+++ b/gc.c | |
@@ -6140,7 +6140,7 @@ gc_profile_total_time(VALUE self) | |
if (objspace->profile.run && objspace->profile.next_index > 0) { | |
size_t i; | |
- size_t count = objspace->profile.next_index - 1; | |
+ size_t count = objspace->profile.next_index; | |
for (i = 0; i < count; i++) { | |
time += objspace->profile.records[i].gc_time; | |
diff --git a/test/ruby/test_gc.rb b/test/ruby/test_gc.rb | |
index dfe5e31..4218dab 100644 | |
--- a/test/ruby/test_gc.rb | |
+++ b/test/ruby/test_gc.rb | |
@@ -166,6 +166,16 @@ class TestGc < Test::Unit::TestCase | |
eom | |
end | |
+ def test_profiler_total_time | |
+ GC::Profiler.enable | |
+ GC::Profiler.clear | |
+ | |
+ GC.start | |
+ assert_operator(GC::Profiler.total_time, :>, 0) | |
+ ensure | |
+ GC::Profiler.disable | |
+ end | |
+ | |
def test_finalizing_main_thread | |
assert_in_out_err(%w[--disable-gems], <<-EOS, ["\"finalize\""], [], "[ruby-dev:46647]") | |
ObjectSpace.define_finalizer(Thread.main) { p 'finalize' } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment