diff options
author | Peter Zhu <peter@peterzhu.ca> | 2023-02-14 15:55:25 -0500 |
---|---|---|
committer | Peter Zhu <peter@peterzhu.ca> | 2023-02-21 08:05:31 -0500 |
commit | 93ac7405b80cc61930d73da04441fa09af1851e1 (patch) | |
tree | 03b5a1f70186beee0b1dd01a44dfeda47f11d237 /test | |
parent | d7c1ca48bf7754a23bfe1559422736029b4787a0 (diff) |
Add marking and sweeping time to GC.stat
There is a `time` key in GC.stat that gives us the total time spent in
GC. However, we don't know what proportion of the time is spent between
marking and sweeping. This makes it difficult to tune the GC as we're
not sure where to focus our efforts on.
This PR adds keys `marking_time` and `sweeping_time` to GC.stat for the
time spent marking and sweeping, in milliseconds.
[Feature #19437]
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/7304
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_gc.rb | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/test/ruby/test_gc.rb b/test/ruby/test_gc.rb index 0e3a3b4e1c..4f1d32580a 100644 --- a/test/ruby/test_gc.rb +++ b/test/ruby/test_gc.rb @@ -128,6 +128,8 @@ class TestGc < Test::Unit::TestCase omit 'stress' if GC.stress stat = GC.stat + # marking_time + sweeping_time could differ from time by 1 because they're stored in nanoseconds + assert_in_delta stat[:time], stat[:marking_time] + stat[:sweeping_time], 1 assert_equal stat[:total_allocated_pages], stat[:heap_allocated_pages] + stat[:total_freed_pages] assert_operator stat[:heap_sorted_length], :>=, stat[:heap_eden_pages] + stat[:heap_allocatable_pages], "stat is: " + stat.inspect assert_equal stat[:heap_available_slots], stat[:heap_live_slots] + stat[:heap_free_slots] + stat[:heap_final_slots] |