From b0bbcaedc7c855be1df8c3bbbfd7b80424905047 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Thu, 25 Nov 2021 11:00:38 -0500 Subject: Revert "Add GC.stat_size_pool to get stats for a size pool" This reverts commit 6157619bb68e4307cdf065cb73d5bfcec30d042d. We'll wait for comments in the open ticket: https://bugs.ruby-lang.org/issues/18364 --- test/ruby/test_gc.rb | 48 ------------------------------------------------ 1 file changed, 48 deletions(-) (limited to 'test/ruby') diff --git a/test/ruby/test_gc.rb b/test/ruby/test_gc.rb index 1cb030e76a..baf9971c48 100644 --- a/test/ruby/test_gc.rb +++ b/test/ruby/test_gc.rb @@ -139,54 +139,6 @@ class TestGc < Test::Unit::TestCase end end - def test_stat_size_pool - skip 'stress' if GC.stress - - stat_size_pool = {} - stat = {} - # Initialize to prevent GC in future calls - GC.stat_size_pool(0, stat_size_pool) - GC.stat(stat) - - GC::INTERNAL_CONSTANTS[:SIZE_POOL_COUNT].times do |i| - GC.stat_size_pool(i, stat_size_pool) - GC.stat(stat) - - assert_equal GC::INTERNAL_CONSTANTS[:RVALUE_SIZE] * (2**i), stat_size_pool[:slot_size] - assert_operator stat_size_pool[:heap_allocatable_pages], :<=, stat[:heap_allocatable_pages] - assert_operator stat_size_pool[:heap_eden_pages], :<=, stat[:heap_eden_pages] - assert_operator stat_size_pool[:heap_eden_slots], :>=, 0 - assert_operator stat_size_pool[:heap_tomb_pages], :<=, stat[:heap_tomb_pages] - assert_operator stat_size_pool[:heap_tomb_slots], :>=, 0 - end - - assert_raise(ArgumentError) { GC.stat_size_pool(-1) } - assert_raise(ArgumentError) { GC.stat_size_pool(GC::INTERNAL_CONSTANTS[:SIZE_POOL_COUNT]) } - end - - def test_stat_size_pool_constraints - skip 'stress' if GC.stress - - stat = GC.stat - stat_size_pools = [] - # Initialize to prevent GC in future calls - GC::INTERNAL_CONSTANTS[:SIZE_POOL_COUNT].times do |i| - stat_size_pools << GC.stat_size_pool(i) - end - # Get actual stats - GC.stat(stat) - GC::INTERNAL_CONSTANTS[:SIZE_POOL_COUNT].times do |i| - GC.stat_size_pool(i, stat_size_pools[i]) - end - - stat_size_pools_sum = stat_size_pools[0].keys.to_h { |k| [k, stat_size_pools.sum { |e| e[k] }] } - - assert_equal stat[:heap_allocatable_pages], stat_size_pools_sum[:heap_allocatable_pages] - assert_equal stat[:heap_eden_pages], stat_size_pools_sum[:heap_eden_pages] - assert_equal stat[:heap_tomb_pages], stat_size_pools_sum[:heap_tomb_pages] - assert_equal stat[:heap_available_slots], stat_size_pools_sum[:heap_eden_slots] + stat_size_pools_sum[:heap_tomb_slots] - end - def test_latest_gc_info skip 'stress' if GC.stress -- cgit v1.2.3