summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorPeter Zhu <peter@peterzhu.ca>2021-11-25 11:00:38 -0500
committerPeter Zhu <peter@peterzhu.ca>2021-11-25 11:01:50 -0500
commitb0bbcaedc7c855be1df8c3bbbfd7b80424905047 (patch)
treeb4014c8c7e22fef87fea8ceab7cb7c1030faf734 /test/ruby
parent6157619bb68e4307cdf065cb73d5bfcec30d042d (diff)
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
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/5176
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_gc.rb48
1 files changed, 0 insertions, 48 deletions
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