From 29dbed183e78db090032ae6d854aa44e34652bba Mon Sep 17 00:00:00 2001 From: tmm1 Date: Tue, 29 Oct 2013 02:11:26 +0000 Subject: * gc.c (gc_profile_total_time): fix off-by-one error in GC::Profiler.total_time. * test/ruby/test_gc.rb (class TestGc): test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43457 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_gc.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_gc.rb b/test/ruby/test_gc.rb index dfe5e31cfb..4218dab888 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' } -- cgit v1.2.3