* 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
This commit is contained in:
parent
fb3bd5a18a
commit
29dbed183e
@ -1,3 +1,9 @@
|
|||||||
|
Tue Oct 29 11:10:08 2013 Aman Gupta <ruby@tmm1.net>
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
Tue Oct 29 09:53:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
|
Tue Oct 29 09:53:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
|
||||||
|
|
||||||
* insns.def, vm.c, vm_insnhelper.c, vm_insnhelper.h, vm_method.c: split
|
* insns.def, vm.c, vm_insnhelper.c, vm_insnhelper.h, vm_method.c: split
|
||||||
|
2
gc.c
2
gc.c
@ -6140,7 +6140,7 @@ gc_profile_total_time(VALUE self)
|
|||||||
|
|
||||||
if (objspace->profile.run && objspace->profile.next_index > 0) {
|
if (objspace->profile.run && objspace->profile.next_index > 0) {
|
||||||
size_t i;
|
size_t i;
|
||||||
size_t count = objspace->profile.next_index - 1;
|
size_t count = objspace->profile.next_index;
|
||||||
|
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
time += objspace->profile.records[i].gc_time;
|
time += objspace->profile.records[i].gc_time;
|
||||||
|
@ -166,6 +166,16 @@ class TestGc < Test::Unit::TestCase
|
|||||||
eom
|
eom
|
||||||
end
|
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
|
def test_finalizing_main_thread
|
||||||
assert_in_out_err(%w[--disable-gems], <<-EOS, ["\"finalize\""], [], "[ruby-dev:46647]")
|
assert_in_out_err(%w[--disable-gems], <<-EOS, ["\"finalize\""], [], "[ruby-dev:46647]")
|
||||||
ObjectSpace.define_finalizer(Thread.main) { p 'finalize' }
|
ObjectSpace.define_finalizer(Thread.main) { p 'finalize' }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user